|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.hp.hpl.mesa.rdf.jena.rdb.ResultSetIterator
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 and getRow methods in subclasses to return an object collection derived from the row contents instead of the raw row contents.
Constructor Summary | |
ResultSetIterator()
Create an empty iterator. |
|
ResultSetIterator(java.sql.ResultSet resultSet,
java.sql.PreparedStatement sourceStatement)
Iterate over the results of a PreparedStatement, close the statement when finished. |
|
ResultSetIterator(java.sql.ResultSet resultSet,
java.sql.PreparedStatement sourceStatement,
SQLCache cache,
java.lang.String opname)
Iterate over the results of a PreparedStatement generated by an SQLCache |
Method Summary | |
void |
close()
Clean up the allocated resources - result set and statement. |
java.lang.Object |
getSingleton()
Get a singleton result (single column from single row) and close the iterator. |
boolean |
hasNext()
Test if there is a next result to return |
java.lang.Object |
next()
Return the current row |
void |
remove()
Delete the current row entry |
void |
reset(java.sql.ResultSet resultSet,
java.sql.PreparedStatement sourceStatement,
SQLCache cache,
java.lang.String opname)
Reset an existing iterator to scan a new result set. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResultSetIterator()
public ResultSetIterator(java.sql.ResultSet resultSet, java.sql.PreparedStatement sourceStatement, SQLCache cache, java.lang.String opname)
resultSet
- the result set being iterated oversourceStatement
- The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cachecache
- The originating SQLcache to return the statement to, can be nullopname
- The name of the original operation that lead to this statement, can be null if SQLCache is nullpublic ResultSetIterator(java.sql.ResultSet resultSet, java.sql.PreparedStatement sourceStatement)
resultSet
- the result set being iterated oversourceStatement
- The source Statement to be closed when the iterator finishesMethod Detail |
public void reset(java.sql.ResultSet resultSet, java.sql.PreparedStatement sourceStatement, SQLCache cache, java.lang.String opname)
resultSet
- the result set being iterated oversourceStatement
- The source Statement to be cleaned up when the iterator finishes - return it to cache or close it if no cachecache
- The originating SQLcache to return the statement to, can be nullopname
- The name of the original operation that lead to this statement, can be null if SQLCache is nullpublic boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next()
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
public void close()
close
in interface ClosableIterator
public java.lang.Object getSingleton() throws java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |