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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the cursor.voiddelete()Deletes the current record.booleaneof()Tests whether this cursor is positioned behind the last record.booleanfirst()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.booleangetBoolean(int field) Returns specified field's value as boolean.booleangetBoolean(String fieldName) Returns specified field's value as boolean.intReturns number of fields in the current record.getFieldType(int field) Returns field type.getFieldType(String fieldName) Returns field type.doublegetFloat(int field) Returns specified field's value as float.doubleReturns specified field's value as float.longgetInteger(int field) Returns specified field's value as integer.longgetInteger(String fieldName) Returns specified field's value as integer.longgetLimit()Returns limit of this cursor.longReturns number of rows accessible with this cursor.longgetRowId()Gets row Id of the current record.longReturns 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.booleangoTo(long rowId) Goes to the record with the specified row Id.booleangoToRow(long rowIndex) Goes to the row with the specified index.booleanisNull(int field) Tests field value for null.booleanTests field value for null.booleanlast()Goes to the last record.booleannext()Goes to the next record.booleanprevious()Goes to the previous record.reverse()Returns cursor with the order reversed.voidsetLimit(long limit) Sets limit for this cursor.voidUpdates the current record.voidupdateByFieldNames(Map<String, Object> values) Updates the current record.voidupdateByFieldNamesOr(SqlJetConflictAction onConflict, Map<String, Object> values) Updates the current record.voidupdateOr(SqlJetConflictAction onConflict, Object... values) Updates the current record.longupdateWithRowId(long rowId, Object... values) Updates rowId and values in the current record.longupdateWithRowIdOr(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.
-