|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
R
- The cursor's record typepublic interface Cursor<R extends Record>
Cursors allow for lazy, sequential access to an underlying JDBC
ResultSet
. Unlike Result
, data can only be accessed
sequentially, using an Iterator
, or the cursor's hasNext()
and fetch()
methods.
Client code must close this Cursor
in order to close the underlying
PreparedStatement
and ResultSet
Method Summary | ||
---|---|---|
void |
close()
Explicitly close the underlying PreparedStatement and
ResultSet
If you fetch all records from the underlying ResultSet , jOOQ
Cursor implementations will close themselves for you. |
|
Result<R> |
fetch()
Fetch all remaining records as a result. |
|
Result<R> |
fetch(int number)
Fetch the next couple of records from the cursor. |
|
|
fetchInto(Class<? extends E> type)
Map resulting records onto a custom type. |
|
|
fetchInto(H handler)
Fetch results into a custom handler callback |
|
|
fetchInto(Table<Z> table)
Map resulting records onto a custom record. |
|
R |
fetchOne()
Fetch the next record from the cursor This will conveniently close the Cursor , after the last
Record was fetched. |
|
|
fetchOneInto(Class<? extends E> type)
Map the next resulting record onto a custom type. |
|
|
fetchOneInto(H handler)
Fetch the next record into a custom handler callback This will conveniently close the Cursor , after the last
Record was fetched. |
|
|
fetchOneInto(Table<Z> table)
Map the next resulting record onto a custom record. |
|
boolean |
hasNext()
Check whether this cursor has a next record This will conveniently close the Cursor , after the last
Record was fetched. |
|
boolean |
isClosed()
Check whether this Cursor has been explicitly or
"conveniently" closed. |
|
ResultSet |
resultSet()
Get the Cursor 's underlying ResultSet
If you modify the underlying ResultSet , the
Cursor may be affected and in some cases, rendered unusable. |
Methods inherited from interface org.jooq.FieldProvider |
---|
getField, getField, getField, getFields, getIndex |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
boolean hasNext() throws DataAccessException
This will conveniently close the Cursor
, after the last
Record
was fetched.
DataAccessException
- if something went wrong executing the queryResult<R> fetch() throws DataAccessException
This will conveniently close the Cursor
, after the last
Record
was fetched.
DataAccessException
- if something went wrong executing the queryResult<R> fetch(int number) throws DataAccessException
This will conveniently close the Cursor
, after the last
Record
was fetched.
number
- The number of records to fetch. If this is 0
or negative an empty list is returned, the cursor is
untouched. If this is greater than the number of remaining
records, then all remaining records are returned.
DataAccessException
- if something went wrong executing the queryR fetchOne() throws DataAccessException
This will conveniently close the Cursor
, after the last
Record
was fetched.
null
if there is
no next record.
DataAccessException
- if something went wrong executing the query<H extends RecordHandler<R>> H fetchOneInto(H handler) throws DataAccessException
This will conveniently close the Cursor
, after the last
Record
was fetched.
handler
- The handler callback
DataAccessException
- if something went wrong executing the query<H extends RecordHandler<R>> H fetchInto(H handler) throws DataAccessException
handler
- The handler callback
DataAccessException
- if something went wrong executing the query<E> E fetchOneInto(Class<? extends E> type) throws DataAccessException, MappingException
This is the same as calling fetchOne().into(type)
. See
Record.into(Class)
for more details
E
- The generic entity type.type
- The entity type.
DataAccessException
- if something went wrong executing the query
MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsRecord.into(Class)
,
Result.into(Class)
<E> List<E> fetchInto(Class<? extends E> type) throws DataAccessException, MappingException
This is the same as calling fetch().into(type)
. See
Record.into(Class)
for more details
E
- The generic entity type.type
- The entity type.
DataAccessException
- if something went wrong executing the query
MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsRecord.into(Class)
,
Result.into(Class)
<Z extends Record> Z fetchOneInto(Table<Z> table) throws DataAccessException, MappingException
This is the same as calling fetchOne().into(table)
. See
Record.into(Class)
for more details
Z
- The generic table record type.table
- The table type.
DataAccessException
- if something went wrong executing the query
MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsRecord.into(Class)
,
Result.into(Class)
<Z extends Record> List<Z> fetchInto(Table<Z> table) throws DataAccessException, MappingException
This is the same as calling fetch().into(table)
. See
Record.into(Class)
for more details
Z
- The generic table record type.table
- The table type.
DataAccessException
- if something went wrong executing the query
MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsRecord.into(Class)
,
Result.into(Class)
void close() throws DataAccessException
PreparedStatement
and
ResultSet
If you fetch all records from the underlying ResultSet
, jOOQ
Cursor
implementations will close themselves for you.
Calling close()
again will have no effect.
DataAccessException
- if something went wrong executing the queryboolean isClosed()
Cursor
has been explicitly or
"conveniently" closed.
Explicit closing can be achieved by calling close()
from client
code. "Convenient" closing is done by any of the other methods, when the
last record was fetched.
ResultSet resultSet()
Cursor
's underlying ResultSet
If you modify the underlying ResultSet
, the
Cursor
may be affected and in some cases, rendered unusable.
ResultSet
. May be null
,
for instance when the Cursor
is closed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |