R - The cursor's record typepublic interface Cursor<R extends Record> extends Iterable<R>, AutoCloseable
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
 
 Note: Unlike usual implementations of Iterable, a Cursor
 can only provide one Iterator!
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Explicitly close the underlying  PreparedStatementandResultSet. | 
| Result<R> | fetch()Fetch all remaining records as a result. | 
| Result<R> | fetch(int number)Fetch the next couple of records from the cursor. | 
| <E> List<E> | fetch(RecordMapper<? super R,E> mapper)Fetch results into a custom mapper callback. | 
| <E> List<E> | fetchInto(Class<? extends E> type)Map resulting records onto a custom type. | 
| <H extends RecordHandler<? super R>> | fetchInto(H handler)Fetch results into a custom handler callback. | 
| <Z extends Record> | fetchInto(Table<Z> table)Map resulting records onto a custom record. | 
| R | fetchOne()Fetch the next record from the cursor. | 
| <E> E | fetchOne(RecordMapper<? super R,E> mapper)Fetch the next record into a custom mapper callback. | 
| <E> E | fetchOneInto(Class<? extends E> type)Map the next resulting record onto a custom type. | 
| <H extends RecordHandler<? super R>> | fetchOneInto(H handler)Fetch the next record into a custom handler callback. | 
| <Z extends Record> | fetchOneInto(Table<Z> table)Map the next resulting record onto a custom record. | 
| Optional<R> | fetchOptional()Fetch the next record from the cursor. | 
| <E> Optional<E> | fetchOptional(RecordMapper<? super R,E> mapper)Fetch the next record into a custom mapper callback. | 
| <E> Optional<E> | fetchOptionalInto(Class<? extends E> type)Map the next resulting record onto a custom type. | 
| <Z extends Record> | fetchOptionalInto(Table<Z> table)Map the next resulting record onto a custom record. | 
| <T> Field<T> | field(Field<T> field)Get a specific field from this Cursor. | 
| Field<?> | field(int index)Get a specific field from this Cursor. | 
| Field<?> | field(Name name)Get a specific qualified field from this Cursor. | 
| Field<?> | field(String name)Get a specific field from this Cursor. | 
| Field<?>[] | fields()Get all fields from this Cursor. | 
| Field<?>[] | fields(Field<?>... fields)Get all fields from this Cursor, providing some fields. | 
| Field<?>[] | fields(int... fieldIndexes)Get all fields from this Cursor, providing some field indexes. | 
| Field<?>[] | fields(Name... fieldNames)Get all fields from this Cursor, providing some field names. | 
| Field<?>[] | fields(String... fieldNames)Get all fields from this Cursor, providing some field names. | 
| Row | fieldsRow()Get this cursor's fields as a  Row. | 
| boolean | hasNext()Check whether this cursor has a next record. | 
| boolean | isClosed()Check whether this  Cursorhas been explicitly or
 "conveniently" closed. | 
| RecordType<R> | recordType()Get this cursor's row type. | 
| ResultSet | resultSet()Get the  Cursor's underlyingResultSet. | 
| java.util.stream.Stream<R> | stream()Turn this  Cursorinto aStream. | 
forEach, iterator, spliteratorRecordType<R> recordType()
<T> Field<T> field(Field<T> field)
This will return:
null otherwise.
 Row.field(Field)Field<?> field(String name)
Row.field(String)Field<?> field(Name name)
Row.field(Name)Field<?> field(int index)
Row.field(int)Field<?>[] fields()
Row.fields()Field<?>[] fields(Field<?>... fields)
Row.fields(Field...)Field<?>[] fields(String... fieldNames)
Row.fields(String...)Field<?>[] fields(Name... fieldNames)
Row.fields(Name...)Field<?>[] fields(int... fieldIndexes)
Row.fields(int...)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.
 
 The result and its contained records are attached to the original
 Configuration by default. Use Settings.isAttachRecords()
 to override this behaviour.
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.
 
 The result and its contained records are attached to the original
 Configuration by default. Use Settings.isAttachRecords()
 to override this behaviour.
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 query<H extends RecordHandler<? super R>> H fetchInto(H handler) throws DataAccessException
 The resulting records are attached to the original Configuration
 by default. Use Settings.isAttachRecords() to override this
 behaviour.
handler - The handler callbackDataAccessException - if something went wrong executing the query<E> List<E> fetch(RecordMapper<? super R,E> mapper) throws DataAccessException
mapper - The mapper callbackDataAccessException - if something went wrong executing the query<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 queryMappingException - wrapping any reflection or data type conversion
             exception that might have occurred while mapping recordsRecord.into(Class), 
Result.into(Class), 
DefaultRecordMapper<Z extends Record> Result<Z> fetchInto(Table<Z> table) throws DataAccessException, MappingException
 This is the same as calling fetch().into(table). See
 Record.into(Class) for more details
 
 The result and its contained records are attached to the original
 Configuration by default. Use Settings.isAttachRecords()
 to override this behaviour.
Z - The generic table record type.table - The table type.DataAccessException - if something went wrong executing the queryMappingException - wrapping any reflection or data type conversion
             exception that might have occurred while mapping recordsRecord.into(Class), 
Result.into(Class)R fetchOne() throws DataAccessException
 This will conveniently close the Cursor, after the last
 Record was fetched.
 
 The resulting record is attached to the original Configuration by
 default. Use Settings.isAttachRecords() to override this
 behaviour.
null if there is
         no next record.DataAccessException - if something went wrong executing the query<H extends RecordHandler<? super R>> H fetchOneInto(H handler) throws DataAccessException
 This will conveniently close the Cursor, after the last
 Record was fetched.
 
 The resulting record is attached to the original Configuration by
 default. Use Settings.isAttachRecords() to override this
 behaviour.
handler - The handler callbackDataAccessException - 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 queryMappingException - wrapping any reflection or data type conversion
             exception that might have occurred while mapping recordsRecord.into(Class), 
Result.into(Class), 
DefaultRecordMapper<E> E fetchOne(RecordMapper<? super R,E> mapper) throws DataAccessException
 This will conveniently close the Cursor, after the last
 Record was fetched.
mapper - The mapper callbackDataAccessException - if something went wrong executing the query<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
 
 The resulting record is attached to the original Configuration by
 default. Use Settings.isAttachRecords() to override this
 behaviour.
Z - The generic table record type.table - The table type.DataAccessException - if something went wrong executing the queryMappingException - wrapping any reflection or data type conversion
             exception that might have occurred while mapping recordsRecord.into(Class), 
Result.into(Class)Optional<R> fetchOptional() throws DataAccessException
 This will conveniently close the Cursor, after the last
 Record was fetched.
 
 The resulting record is attached to the original Configuration by
 default. Use Settings.isAttachRecords() to override this
 behaviour.
DataAccessException - if something went wrong executing the query<E> Optional<E> fetchOptionalInto(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 queryMappingException - wrapping any reflection or data type conversion
             exception that might have occurred while mapping recordsRecord.into(Class), 
Result.into(Class), 
DefaultRecordMapper<E> Optional<E> fetchOptional(RecordMapper<? super R,E> mapper) throws DataAccessException
 This will conveniently close the Cursor, after the last
 Record was fetched.
mapper - The mapper callbackDataAccessException - if something went wrong executing the query<Z extends Record> Optional<Z> fetchOptionalInto(Table<Z> table) throws DataAccessException, MappingException
 This is the same as calling fetchOne().into(table). See
 Record.into(Class) for more details
 
 The resulting record is attached to the original Configuration by
 default. Use Settings.isAttachRecords() to override this
 behaviour.
Z - The generic table record type.table - The table type.DataAccessException - if something went wrong executing the queryMappingException - wrapping any reflection or data type conversion
             exception that might have occurred while mapping recordsRecord.into(Class), 
Result.into(Class)java.util.stream.Stream<R> stream() throws DataAccessException
Cursor into a Stream.DataAccessException - if something went wrong executing the queryvoid 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.
close in interface AutoCloseableDataAccessException - 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.
 
 This will return a ResultSet wrapping the JDBC driver's
 ResultSet. Closing this ResultSet may close the
 producing Statement or PreparedStatement, depending on
 your setting for ResultQuery.keepStatement(boolean).
 
 Modifying this ResultSet will affect this
 Cursor.
ResultSet. May be null,
         for instance when the Cursor is closed.Copyright © 2017. All Rights Reserved.