com.ibm.pdq.runtime.data.handlers
Class PagingResultIterator<T>
java.lang.Object
com.ibm.pdq.runtime.data.handlers.BaseResultIterator<T>
com.ibm.pdq.runtime.data.handlers.PagingResultIterator<T>
- All Implemented Interfaces:
- ResultIterator<T>, Iterator<T>
-
public class PagingResultIterator<T>
- extends BaseResultIterator<T>
The PagingResultIterator<T>
class allows the contents of a specified page of the results of an SQL statement to be processed as an Iterator
in which each row will be returned in a specified format. The
page to be processed and the format in which each row will be returned is specified in the call to the constructor. The class has appropriate methods for returning the contents of the results.
These methods include hasNext()
, which indicates if a "next" result
row is available, BaseResultIterator.next()
, which returns the formatted contents of
the "next" row, and BaseResultIterator.close()
, which closes the
ResultIterator
, along with freeing all associated data source resources.
Constructor Summary
Constructor Summary Constructor and Description |
PagingResultIterator(ResultSet resultSet, RowHandler<T> singleRowHandler, int absoluteStartingRow, int absoluteEndingRow)
Constructs an instance of PagingResultIterator<T> which allows the contents of the specified page of the results of an SQL statement to be processed as an
Iterator in which each row will be returned in a
specified format. |
Method Summary
Method Summary Return Data Type | Method Name and Description |
boolean |
hasNext()
Returns true if there is a "next" row available in the query results page and false otherwise. |
PagingResultIterator
public PagingResultIterator(ResultSet resultSet,
RowHandler<T> singleRowHandler,
int absoluteStartingRow,
int absoluteEndingRow)
-
Constructs an instance of
PagingResultIterator<T>
which allows the contents of the specified page of the results of an SQL statement to be processed as an Iterator
in which each row will be returned in a specified
format. The page to be processed is indicated by absoluteStartingRow
and absoluteEndingRow
, and the format in which each row will be returned is indicated by
singleRowHandler
.
- Parameters:
resultSet
- A ResultSet
representing
the results from an SQL statement.
singleRowHandler
- The instance of RowHandler
that will be used to process each row from resultSet
.
absoluteStartingRow
- The row number of the first row on the resultSet
page to be processed. absoluteStartingRow
must be greater than or
equal to 1, and absoluteStartingRow
must be less than or equal to absoluteEndingRow
.
absoluteEndingRow
- The row number of the last row on the resultSet
page to be processed. absoluteStartingRow
must be greater than or equal
to 1, and absoluteStartingRow
must be less than or equal to absoluteEndingRow
.
hasNext
public boolean hasNext()
- Returns
true
if there is a "next" row available in the query results page and false
otherwise. hasNext()
should be called before calling BaseResultIterator.next()
.
-
- Specified by:
hasNext
in interface Iterator<T>
- Overrides:
hasNext
in class BaseResultIterator<T>
-
- Returns:
true
if there is a "next" row available in the query results page and false
otherwise.