Package org.tmatesoft.sqljet.core.table
Interface ISqlJetCursor
- All Known Implementing Classes:
SqlJetCursor
,SqlJetIndexOrderCursor
,SqlJetIndexScopeCursor
,SqlJetReverseOrderCursor
,SqlJetRowNumCursor
,SqlJetTableDataCursor
public interface ISqlJetCursor
This class represents table cursor that may be used to browse over records in
the table, to modify or delete existing records.
- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the cursor.void
delete()
Deletes the current record.boolean
eof()
Tests whether this cursor is positioned behind the last record.boolean
first()
Goes to the first record.byte[]
getBlobAsArray
(int field) Returns specified field's value as BLOB.byte[]
getBlobAsArray
(String fieldName) Returns specified field's value as BLOB.getBlobAsStream
(int field) Returns specified field's value as BLOB.getBlobAsStream
(String fieldName) Returns specified field's value as BLOB.boolean
getBoolean
(int field) Returns specified field's value as boolean.boolean
getBoolean
(String fieldName) Returns specified field's value as boolean.int
Returns number of fields in the current record.getFieldType
(int field) Returns field type.getFieldType
(String fieldName) Returns field type.double
getFloat
(int field) Returns specified field's value as float.double
Returns specified field's value as float.long
getInteger
(int field) Returns specified field's value as integer.long
getInteger
(String fieldName) Returns specified field's value as integer.long
getLimit()
Returns limit of this cursor.long
Returns number of rows accessible with this cursor.long
getRowId()
Gets row Id of the current record.long
Returns index of the current row.Object[]
Returns all field values of current row.getString
(int field) Returns specified field's value as String.Returns specified field's value as String.getValue
(int field) Returns value of the field of the specified index in the current row.Returns value of the field with the specified name in the current row.boolean
goTo
(long rowId) Goes to the record with the specified row Id.boolean
goToRow
(long rowIndex) Goes to the row with the specified index.boolean
isNull
(int field) Tests field value for null.boolean
Tests field value for null.boolean
last()
Goes to the last record.boolean
next()
Goes to the next record.boolean
previous()
Goes to the previous record.reverse()
Returns cursor with the order reversed.void
setLimit
(long limit) Sets limit for this cursor.void
Updates the current record.void
updateByFieldNames
(Map<String, Object> values) Updates the current record.void
updateByFieldNamesOr
(SqlJetConflictAction onConflict, Map<String, Object> values) Updates the current record.void
updateOr
(SqlJetConflictAction onConflict, Object... values) Updates the current record.long
updateWithRowId
(long rowId, Object... values) Updates rowId and values in the current record.long
updateWithRowIdOr
(SqlJetConflictAction onConflict, long rowId, Object... values) Updates rowId and values in the current record.
-
Method Details
-
close
Closes the cursor.- Throws:
SqlJetException
-
getRowId
Gets row Id of the current record.- Returns:
- row Id of the current record.
- Throws:
SqlJetException
-
goTo
Goes to the record with the specified row Id.- Parameters:
rowId
- row Id- Returns:
- true if cursor was moved successfully.
- Throws:
SqlJetException
-
eof
Tests whether this cursor is positioned behind the last record.- Returns:
- true if the cursor is not on a record and fields can't be read.
- Throws:
SqlJetException
-
first
Goes to the first record.- Returns:
- true if there is at least one record.
- Throws:
SqlJetException
-
last
Goes to the last record.- Returns:
- true if there is at least one record.
- Throws:
SqlJetException
-
next
Goes to the next record.- Returns:
- true if there is at least one record and end of cursor is not reached yet
- Throws:
SqlJetException
-
previous
Goes to the previous record.- Returns:
- true if there is at least one record and begin of cursor is not reached yet
- Throws:
SqlJetException
-
getFieldsCount
Returns number of fields in the current record.- Throws:
SqlJetException
-
getFieldType
Returns field type.- Parameters:
field
- index of the field- Returns:
- type of field
- Throws:
SqlJetException
-
getFieldType
Returns field type.- Parameters:
fieldName
- name of the field- Returns:
- type of field
- Throws:
SqlJetException
-
isNull
Tests field value for null.- Parameters:
field
- number of field begin from zero- Returns:
- true if field value is null
- Throws:
SqlJetException
-
isNull
Tests field value for null.- Returns:
- true if field value is null
- Throws:
SqlJetException
-
getString
Returns specified field's value as String.- Parameters:
field
- index of the field- Returns:
- field's value as string
- Throws:
SqlJetException
-
getString
Returns specified field's value as String.- Parameters:
fieldName
- name of the field- Returns:
- field's value as string
- Throws:
SqlJetException
-
getInteger
Returns specified field's value as integer.- Parameters:
field
- index of the field- Returns:
- field's value as integer
- Throws:
SqlJetException
-
getInteger
Returns specified field's value as integer.- Parameters:
fieldName
- name of the field- Throws:
SqlJetException
-
getFloat
Returns specified field's value as float.- Parameters:
field
- index of the field- Returns:
- field's value as real
- Throws:
SqlJetException
-
getFloat
Returns specified field's value as float.- Parameters:
fieldName
- name of the field- Throws:
SqlJetException
-
getBoolean
Returns specified field's value as boolean.- Parameters:
field
- index of the field- Returns:
- field value
- Throws:
SqlJetException
-
getBoolean
Returns specified field's value as boolean.- Parameters:
fieldName
- name of the field- Returns:
- field value
- Throws:
SqlJetException
-
getBlobAsArray
Returns specified field's value as BLOB.- Parameters:
field
- index of the field- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getBlobAsArray
Returns specified field's value as BLOB.- Parameters:
fieldName
- name of the field- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getBlobAsStream
Returns specified field's value as BLOB.- Parameters:
field
- number of field begin from zero- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getBlobAsStream
Returns specified field's value as BLOB.- Parameters:
fieldName
- name of the field- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getValue
Returns value of the field of the specified index in the current row.- Parameters:
field
- index of the field- Throws:
SqlJetException
-
getValue
Returns value of the field with the specified name in the current row.- Parameters:
fieldName
- name of the field- Throws:
SqlJetException
-
getRowValues
Returns all field values of current row.- Returns:
- field values array
- Throws:
SqlJetException
-
update
Updates the current record.- Parameters:
values
- New record values.- Throws:
SqlJetException
-
updateWithRowId
Updates rowId and values in the current record.- Parameters:
values
- New record values.- Throws:
SqlJetException
-
updateByFieldNames
Updates the current record.- Parameters:
values
- New record values mapped by field names.- Throws:
SqlJetException
-
updateOr
Updates the current record. Implements ON CONFLICT clause. SeeSqlJetConflictAction
.- Parameters:
onConflict
-SqlJetConflictAction
.values
- New record values.- Throws:
SqlJetException
-
updateWithRowIdOr
long updateWithRowIdOr(SqlJetConflictAction onConflict, long rowId, Object... values) throws SqlJetException Updates rowId and values in the current record. Implements ON CONFLICT clause. SeeSqlJetConflictAction
.- Parameters:
onConflict
-SqlJetConflictAction
.values
- New record values.- Throws:
SqlJetException
-
updateByFieldNamesOr
void updateByFieldNamesOr(SqlJetConflictAction onConflict, Map<String, Object> values) throws SqlJetExceptionUpdates the current record. Implements ON CONFLICT clause. SeeSqlJetConflictAction
.- Parameters:
onConflict
-SqlJetConflictAction
.values
- New record values mapped by field names.- Throws:
SqlJetException
-
delete
Deletes the current record.- Throws:
SqlJetException
-
reverse
Returns cursor with the order reversed.- Returns:
- cursor that will traverse the same rows as this one, but in reversed order.
- Throws:
SqlJetException
-
getRowCount
Returns number of rows accessible with this cursor.- Returns:
- number of rows
- Throws:
SqlJetException
-
getRowIndex
Returns index of the current row. Index is 1-based, first record has index of one.- Returns:
- 1-based index of the current row.
- Throws:
SqlJetException
-
goToRow
Goes to the row with the specified index. Index is 1-based, first record has index of one.- Parameters:
rowIndex
-- Returns:
- true if cursor has been set on the specified record.
- Throws:
SqlJetException
-
setLimit
Sets limit for this cursor. Negative or zero value resets limit to infinity.- Parameters:
limit
- limit to set or zero to drop the limit.- Throws:
SqlJetException
-
getLimit
long getLimit()Returns limit of this cursor.- Returns:
- limit of this cursor or zero if limit has not been set.
-