public class DefaultResultSetCollector extends Object implements ResultSetCollector
| Constructor and Description |
|---|
DefaultResultSetCollector(boolean fillInUnreadValues) |
| Modifier and Type | Method and Description |
|---|---|
int |
getColumnCount() |
String |
getColumnLabel(int column) |
String |
getColumnName(int column) |
List<List<Object>> |
getRows() |
void |
loadMetaDataIfNeeded(ResultSet rs)
Allow this
ResultSetCollector to obtain a ResultSetMetaData
from the real underlying JDBC ResultSet, and obtains immediately
from it the column count, the column names and column labels. |
boolean |
methodReturned(ResultSetSpy resultSetSpy,
String methodCall,
Object returnValue,
Object targetObject,
Object... methodParams)
Expected to be called by a ResultSetSpy for all jdbc methods.
|
void |
preMethod(ResultSetSpy resultSetSpy,
String methodCall,
Object... methodParams)
Expected to be called by a ResultSetSpy for prior to the execution of all jdbc methods.
|
void |
reset()
Clear the result set so far.
|
public DefaultResultSetCollector(boolean fillInUnreadValues)
public List<List<Object>> getRows()
getRows in interface ResultSetCollectorpublic int getColumnCount()
getColumnCount in interface ResultSetCollectorpublic void reset()
ResultSetCollectorreset in interface ResultSetCollectorpublic void loadMetaDataIfNeeded(ResultSet rs)
ResultSetCollectorResultSetCollector to obtain a ResultSetMetaData
from the real underlying JDBC ResultSet, and obtains immediately
from it the column count, the column names and column labels. This information
needs to be stored, to be later used by the methods getColumnCount and
getColumnName, when this ResultSetCollector is printed.
It is not possible to simply store the ResultSetMetaData,
as the ResultSet might be closed at the time of printing, and some drivers
do not support to query the ResultSetMetaData when the ResultSet
is closed.
The ResultSetMetaData should be requested and the data obtained
by this method only once, so a control needs to be done before obtaining
the ResultSetMetaData. This method should also first check
if rs is not already closed.
This methods is usually called under the hood by the ResultSetCollector
itself, but it might by required to manually load the ResultSetMetaData
if, for instance, the real ResultSet is about to be closed before
the ResultSetCollector requested for the ResultSetMetaData
(for instance, if the method next was not previously called).
loadMetaDataIfNeeded in interface ResultSetCollectorrs - The real JDBC ResultSet that was wrapped into
a ResultSetSpy.public String getColumnName(int column)
getColumnName in interface ResultSetCollectorResultSetMetaData. Index starts from 1.public String getColumnLabel(int column)
public boolean methodReturned(ResultSetSpy resultSetSpy, String methodCall, Object returnValue, Object targetObject, Object... methodParams)
ResultSetCollectormethodReturned in interface ResultSetCollectorpublic void preMethod(ResultSetSpy resultSetSpy, String methodCall, Object... methodParams)
ResultSetCollectorpreMethod in interface ResultSetCollectorCopyright © 2013 Bgee - Swiss Institute of Bioinformatics. All Rights Reserved.