com.ibm.pdq.runtime.data.handlers
Class CallResultIterator<T>
java.lang.Object
com.ibm.pdq.runtime.data.handlers.BaseResultIterator<T>
com.ibm.pdq.runtime.data.handlers.CallResultIterator<T>
- All Implemented Interfaces:
- ResultIterator<T>, Iterator<T>
-
public class CallResultIterator<T>
- extends BaseResultIterator<T>
The CallResultIterator<T> class allows the contents of one of the query results of an SQL stored procedure call to be processed as an Iterator in which each row will be returned in a specified format. 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 BaseResultIterator.hasNext(), which indicates if a "next" result row is
available, BaseResultIterator.next(), which returns the formatted contents of the
"next" row, and close(), which closes the ResultIterator,
along with freeing associated data source resources.
Constructor Summary
Constructor Summary | Constructor and Description |
CallResultIterator(ResultSet resultSet, RowHandler<T> singleRowHandler)
Constructs an instance of CallResultIterator<T> which allows the contents of one of the query results of an SQL stored procedure call 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 |
void |
close()
Closes this instance of CallResultIterator<T> and closes the ResultSet associated with the ResultIterator (if possible), freeing associated data source resources. |
CallResultIterator
public CallResultIterator(ResultSet resultSet,
RowHandler<T> singleRowHandler)
-
Constructs an instance of
CallResultIterator<T> which allows the contents of one of the query results of an SQL stored procedure call to be processed as an Iterator in which each row will be returned in a specified
format. The format in which each row will be returned is indicated by singleRowHandler.
- Parameters:
resultSet - A ResultSet representing
one of the query results of an SQL stored procedure.
singleRowHandler - The instance of RowHandler that will be used to process each row from resultSet.
close
public void close()
-
Closes this instance of
CallResultIterator<T> and closes the ResultSet associated with the ResultIterator (if possible), freeing associated data source resources. No
Exception will occur if the ResultSet is already closed.
CallResultIterator<T> allows SQL stored procedure calls to return multiple ResultSets because close() will close the ResultSet but not the associated Statement, allowing the other ResultSets from the
same Statement to be processed as well.
-
- Specified by:
close in interface ResultIterator<T>
- Overrides:
close in class BaseResultIterator<T>
-
- See Also:
ResultSet.close(), Statement.close()