|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ricebridge.xmlman.RecordProviderSupport
com.ricebridge.xmlman.ResultSetRecordProvider
An implementation of RecordProvider that provides data records for saving
from a ResultSet object.
This class is used to implement the
saveResultSet(*,RecordSpec,ResultSet)
methods in XmlManager.
It simply reads the next data record from the specified ResultSet,
maintaining an internal index of the current record.
ResultSetRecordProvider is designed to be subclassed. You can change the default implementation by calling the
setResultSetRecordProviderClass method of
XmlManagerStore, and providing a subclass of ResultSetRecordProvider.
XmlManagerStore can be accessed using XmlManager.getXmlManagerStore().
The Source Code of this Java class is available under a BSD-style license.
| Field Summary | |
protected int |
iFieldCount
Number of data fields in record, determined by ResultSetMetaData. |
protected boolean |
iFirstRecord
Indicate that internal state is at the first record. |
protected String[] |
iHeaders
Column names. |
protected boolean |
iResetBeforeFirst
Reset ResultSet to beginning after saving data. |
protected ResultSet |
iResultSet
ResultSet containing source data. |
protected int |
iResultSetType
Type of ResultSet, determines if it can be reset. |
protected boolean |
iSaveHeaders
Save the column names as first data record. |
static String |
PROP_ResultSet_resetBeforeFirst
Reset ResultSet after saving
(name for XmlSpec.setProperty: ResultSet.resetBeforeFirst). |
static String |
PROP_ResultSet_saveHeaders
Output headers as first data record (name for XmlSpec.setProperty: ResultSet.saveHeaders). |
| Fields inherited from class com.ricebridge.xmlman.RecordProviderSupport |
iFieldNames |
| Constructor Summary | |
ResultSetRecordProvider()
Create uninitialised for use with setResultSet(java.sql.ResultSet). |
|
ResultSetRecordProvider(ResultSet pResultSet)
Create initialised. |
|
| Method Summary | |
protected void |
endProcessImpl()
Reset ResultSet by calling the beforeFirst method
if PROP_ResultSet_resetBeforeFirst option is true and ResultSet type supports it. |
protected boolean |
hasNextRecordImpl()
Check if there are any more records. |
protected String[] |
nextRecordImpl()
Return next data record as a String[] array. |
void |
setResultSet(ResultSet pResultSet)
Set the ResultSet providing data to save. |
protected void |
setXmlSpecImpl(XmlSpec pXmlSpec)
Handle property settings for saving ResultSets. |
protected void |
startProcessImpl()
Start the saving process. |
| Methods inherited from class com.ricebridge.xmlman.RecordProviderSupport |
endProcess, hasNextRecord, nextRecord, setFieldNames, setFieldNamesImpl, setXmlSpec, startProcess |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String PROP_ResultSet_saveHeaders
XmlSpec.setProperty: ResultSet.saveHeaders).
public static final String PROP_ResultSet_resetBeforeFirst
ResultSet after saving
(name for XmlSpec.setProperty: ResultSet.resetBeforeFirst).
protected ResultSet iResultSet
ResultSet containing source data.
protected boolean iSaveHeaders
setXmlSpecImpl.
protected String[] iHeaders
protected boolean iFirstRecord
protected int iFieldCount
ResultSetMetaData.
protected int iResultSetType
ResultSet, determines if it can be reset.
protected boolean iResetBeforeFirst
ResultSet to beginning after saving data.
| Constructor Detail |
public ResultSetRecordProvider()
setResultSet(java.sql.ResultSet).
public ResultSetRecordProvider(ResultSet pResultSet)
setResultSet for details.
pResultSet - ResultSet providing data| Method Detail |
public void setResultSet(ResultSet pResultSet)
ResultSet providing data to save.
The default number of fields per record is taken from
ResultSetMetaData.getColumnCount()
and the headers (output as the first record when the property ResultSet.saveHeaders is true),
are taken from ResultSetMetaData.getColumnName(int).
pResultSet - ResultSet providing dataprotected void setXmlSpecImpl(XmlSpec pXmlSpec)
ResultSets.
You can change these using XmlSpec.
setXmlSpecImpl in class RecordProviderSupportpXmlSpec - XML specificationRecordListener.setXmlSpec(com.ricebridge.xmlman.XmlSpec),
PROP_ResultSet_saveHeaders,
PROP_ResultSet_resetBeforeFirstprotected void startProcessImpl()
startProcessImpl in class RecordProviderSupportRecordProviderSupport.startProcess(),
RecordProvider.startProcess()protected boolean hasNextRecordImpl()
hasNextRecordImpl in class RecordProviderSupportRecordProviderSupport.hasNextRecord(),
RecordProvider.hasNextRecord()protected String[] nextRecordImpl()
String[] array.
nextRecordImpl in class RecordProviderSupportRecordProviderSupport.nextRecord(),
RecordProvider.nextRecord()protected void endProcessImpl()
ResultSet by calling the beforeFirst method
if PROP_ResultSet_resetBeforeFirst option is true and ResultSet type supports it.
endProcessImpl in class RecordProviderSupportRecordProviderSupport.endProcess(),
RecordProvider.endProcess()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||