| java.lang.Object com.hp.hpl.jena.db.impl.ResultSetIterator
All known Subclasses: com.hp.hpl.jena.db.impl.ResultSetReifIterator, com.hp.hpl.jena.db.impl.ResultSetNodeIterator, com.hp.hpl.jena.db.impl.ResultSetTripleIterator,
ResultSetIterator | public class ResultSetIterator implements ExtendedIterator(Code) | | Iterates over an SQL result set returning each row as an ArrayList of
objects. The returned array is shared at each iteration so calling next() or even hasNext()
changes the array contents. When the iterator terminates the resources
are cleaned up and the underlying SQL PreparedStatement is returned to
the SQLCache pool from whence it came.
Override the extractRow, getRow, and remove methods in subclasses
to return an object collection derived from the row contents instead
of the raw row contents.
author: Dave Reynolds version: $Revision: 1.14 $ on $Date: 2008/01/02 12:08:24 $ |
logger | protected static Log logger(Code) | | |
m_finished | protected boolean m_finished(Code) | | Flag that the iteration has finished
|
m_nCols | protected int m_nCols(Code) | | The number of columns in this result set
|
m_opname | protected String m_opname(Code) | | The name of the original operation that lead to this statement, can be null if SQLCache is null
|
m_prefetched | protected boolean m_prefetched(Code) | | Flag if we have prefeteched the next row but not yet returned it
|
m_resultSet | protected ResultSet m_resultSet(Code) | | The ResultSet being iterated over
|
m_sqlCache | protected SQLCache m_sqlCache(Code) | | The originating SQLcache to return the statement to, can be null
|
m_statement | protected PreparedStatement m_statement(Code) | | The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cache
|
m_statementClean | protected boolean m_statementClean(Code) | | If true, clean/close the prepared statement when iterator is closed
|
ResultSetIterator | public ResultSetIterator()(Code) | | Create an empty iterator.
Needs to be initialized by reset
before it can be accessed. Useful to allow generic functions like
SQLCache.runSQLQuery runSQLQuery to return different iterator types to the client.
|
ResultSetIterator | public ResultSetIterator(ResultSet resultSet, PreparedStatement sourceStatement, SQLCache cache, String opname)(Code) | | Iterate over the results of a PreparedStatement generated by an SQLCache
Parameters: resultSet - the result set being iterated over Parameters: sourceStatement - The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cache Parameters: cache - The originating SQLcache to return the statement to, can be null Parameters: opname - The name of the original operation that lead to this statement, can be null if SQLCache is null |
ResultSetIterator | public ResultSetIterator(ResultSet resultSet, PreparedStatement sourceStatement)(Code) | | Iterate over the results of a PreparedStatement, close the statement when finished.
Parameters: resultSet - the result set being iterated over Parameters: sourceStatement - The source Statement to be closed when the iterator finishes |
andThen | public ExtendedIterator andThen(ClosableIterator other)(Code) | | return a new iterator which delivers all the elements of this iterator and
then all the elements of the other iterator. Does not copy either iterator;
they are consumed as the result iterator is consumed.
|
cantRemove | protected void cantRemove()(Code) | | |
close | public void close()(Code) | | Clean up the allocated resources - result set and statement.
If we know of an SQLCache return the statement there, otherwise close it.
|
extractRow | protected void extractRow() throws Exception(Code) | | Extract the current row
Override in subclasses.
|
finalize | protected void finalize() throws SQLException(Code) | | Clean up the database cursor. Noramlly the client should read to the end
or explicity close but....
|
getRow | protected Object getRow()(Code) | | Return the current row,should have already been extracted.
Override in subclasses.
|
getSingleton | public Object getSingleton() throws SQLException(Code) | | Get a singleton result (single column from single row) and close the iterator.
This may be too specialized but seems to come up a lot - rethink.
|
hasNext | public boolean hasNext()(Code) | | Test if there is a next result to return
|
moveForward | protected void moveForward()(Code) | | More forward one row. Sets the m_finished flag if there is no more to fetch
|
remove | public void remove()(Code) | | Delete the current row entry
|
reset | public void reset(ResultSet resultSet, PreparedStatement sourceStatement, SQLCache cache, String opname)(Code) | | Reset an existing iterator to scan a new result set.
Parameters: resultSet - the result set being iterated over Parameters: sourceStatement - The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cache Parameters: cache - The originating SQLcache to return the statement to, can be null Parameters: opname - The name of the original operation that lead to this statement, can be null if SQLCache is null |
reset | public void reset(ResultSet resultSet, PreparedStatement sourceStatement)(Code) | | Reset an existing iterator to scan a new result set.
Parameters: resultSet - the result set being iterated over Parameters: sourceStatement - The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cachenote: the sourceStatement is not closed or returned when the iterator is closed. |
|
|