T - the collected result type@FunctionalInterface public interface ResultSetScanner<T>
ResultSet.next() over rows it wants to consider.| Modifier and Type | Method and Description |
|---|---|
T |
scanResultSet(Supplier<ResultSet> resultSetSupplier,
StatementContext ctx)
Scans the lazily-supplied result set into a result.
|
T scanResultSet(Supplier<ResultSet> resultSetSupplier, StatementContext ctx) throws SQLException
resultSetSupplier.get() is called.
Implementors that call resultSetSupplier.get() must ensure that the statement context is closed, to
ensure that database resources are freed:
try {
ResultSet resultSet = resultSetSupplier.get()
// generate and return result from the result set.
}
finally {
ctx.close();
}
Alternatively, implementors may return some intermediate result object (e.g. ResultIterable) without
calling resultSetSupplier.get(), in which case the burden of closing resources falls to whichever object
ultimately does get() the result set.
resultSetSupplier - supplies a ResultSet.ctx - the statement context.SQLException - if anything goes wrongCopyright © 2019. All rights reserved.