-
- All Known Subinterfaces:
ResultSetProvider.Large
public interface ResultSetProvider
An implementation of this interface is returned from functions and procedures that are declared to returnSET OF
a complex type. This interface is appropriate when the function will be generating the returned set on the fly; if it will have aResultSet
obtained from a query, it should just returnResultSetHandle
instead. Functions that returnSET OF
a simple type should simply return anIterator
.For a function declared to return
SETOF RECORD
rather than a specific complex type known in advance, thereceiver
argument toassignRowValues
can be queried to learn the number, names, and types of columns expected by the caller.- Author:
- Thomas Hallgren
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ResultSetProvider.Large
Version ofResultSetProvider
where theassignRowValues
method accepting along
row count must be implemented, and theint
version defaults to using it.
-
Method Summary
Modifier and Type Method Description boolean
assignRowValues(ResultSet receiver, int currentRow)
Older version where currentRow is limited to the range ofint
.default boolean
assignRowValues(ResultSet receiver, long currentRow)
This method is called once for each row that should be returned from a procedure that returns a set of rows.void
close()
Called after the last row has returned or when the query evaluator decides that it does not need any more rows.
-
-
-
Method Detail
-
assignRowValues
default boolean assignRowValues(ResultSet receiver, long currentRow) throws SQLException
This method is called once for each row that should be returned from a procedure that returns a set of rows. The receiver is aSingleRowWriter
instance that is used to capture the data for the row.If the return type is
RECORD
rather than a specific complex type, SQL requires a column definition list to follow any use of the function in a query. TheResultSetMetaData
ofreceiver
can be used here to learn the number, names, and types of the columns expected by the caller. (It can also be used in the case of a specific complex type, but in that case the names and types are probably already known.)This default implementation calls
assignRowValues(ResultSet,int)
, or throws anSQLException
with SQLState 54000 (program limit exceeded) if the row number exceedsInteger.MAX_VALUE
.- Parameters:
receiver
- Receiver of values for the given row.currentRow
- Row number, zero on the first call, incremented by one on each subsequent call.- Returns:
true
if a new row was provided,false
if not (end of data).- Throws:
SQLException
-
assignRowValues
boolean assignRowValues(ResultSet receiver, int currentRow) throws SQLException
Older version where currentRow is limited to the range ofint
.- Throws:
SQLException
-
close
void close() throws SQLException
Called after the last row has returned or when the query evaluator decides that it does not need any more rows.- Throws:
SQLException
-
-