Package org.tmatesoft.sqljet.core.table
Interface ISqlJetCursor
-
- All Known Implementing Classes:
SqlJetCursor,SqlJetIndexOrderCursor,SqlJetIndexScopeCursor,SqlJetReverseOrderCursor,SqlJetRowNumCursor,SqlJetTableDataCursor
public interface ISqlJetCursorThis class represents table cursor that may be used to browse over records in the table, to modify or delete existing records.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()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(java.lang.String fieldName)Returns specified field's value as BLOB.java.io.InputStreamgetBlobAsStream(int field)Returns specified field's value as BLOB.java.io.InputStreamgetBlobAsStream(java.lang.String fieldName)Returns specified field's value as BLOB.booleangetBoolean(int field)Returns specified field's value as boolean.booleangetBoolean(java.lang.String fieldName)Returns specified field's value as boolean.intgetFieldsCount()Returns number of fields in the current record.SqlJetValueTypegetFieldType(int field)Returns field type.SqlJetValueTypegetFieldType(java.lang.String fieldName)Returns field type.doublegetFloat(int field)Returns specified field's value as float.doublegetFloat(java.lang.String fieldName)Returns specified field's value as float.longgetInteger(int field)Returns specified field's value as integer.longgetInteger(java.lang.String fieldName)Returns specified field's value as integer.longgetLimit()Returns limit of this cursor.longgetRowCount()Returns number of rows accessible with this cursor.longgetRowId()Gets row Id of the current record.longgetRowIndex()Returns index of the current row.java.lang.Object[]getRowValues()Returns all field values of current row.java.lang.StringgetString(int field)Returns specified field's value as String.java.lang.StringgetString(java.lang.String fieldName)Returns specified field's value as String.java.lang.ObjectgetValue(int field)Returns value of the field of the specified index in the current row.java.lang.ObjectgetValue(java.lang.String fieldName)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.booleanisNull(java.lang.String fieldName)Tests field value for null.booleanlast()Goes to the last record.booleannext()Goes to the next record.booleanprevious()Goes to the previous record.ISqlJetCursorreverse()Returns cursor with the order reversed.voidsetLimit(long limit)Sets limit for this cursor.voidupdate(java.lang.Object... values)Updates the current record.voidupdateByFieldNames(java.util.Map<java.lang.String,java.lang.Object> values)Updates the current record.voidupdateByFieldNamesOr(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)Updates the current record.voidupdateOr(SqlJetConflictAction onConflict, java.lang.Object... values)Updates the current record.longupdateWithRowId(long rowId, java.lang.Object... values)Updates rowId and values in the current record.longupdateWithRowIdOr(SqlJetConflictAction onConflict, long rowId, java.lang.Object... values)Updates rowId and values in the current record.
-
-
-
Method Detail
-
close
void close() throws SqlJetExceptionCloses the cursor.- Throws:
SqlJetException
-
getRowId
long getRowId() throws SqlJetExceptionGets row Id of the current record.- Returns:
- row Id of the current record.
- Throws:
SqlJetException
-
goTo
boolean goTo(long rowId) throws SqlJetExceptionGoes to the record with the specified row Id.- Parameters:
rowId- row Id- Returns:
- true if cursor was moved successfully.
- Throws:
SqlJetException
-
eof
boolean eof() throws SqlJetExceptionTests 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
boolean first() throws SqlJetExceptionGoes to the first record.- Returns:
- true if there is at least one record.
- Throws:
SqlJetException
-
last
boolean last() throws SqlJetExceptionGoes to the last record.- Returns:
- true if there is at least one record.
- Throws:
SqlJetException
-
next
boolean next() throws SqlJetExceptionGoes to the next record.- Returns:
- true if there is at least one record and end of cursor is not reached yet
- Throws:
SqlJetException
-
previous
boolean previous() throws SqlJetExceptionGoes to the previous record.- Returns:
- true if there is at least one record and begin of cursor is not reached yet
- Throws:
SqlJetException
-
getFieldsCount
int getFieldsCount() throws SqlJetExceptionReturns number of fields in the current record.- Throws:
SqlJetException
-
getFieldType
SqlJetValueType getFieldType(int field) throws SqlJetException
Returns field type.- Parameters:
field- index of the field- Returns:
- type of field
- Throws:
SqlJetException
-
getFieldType
SqlJetValueType getFieldType(java.lang.String fieldName) throws SqlJetException
Returns field type.- Parameters:
fieldName- name of the field- Returns:
- type of field
- Throws:
SqlJetException
-
isNull
boolean isNull(int field) throws SqlJetExceptionTests field value for null.- Parameters:
field- number of field begin from zero- Returns:
- true if field value is null
- Throws:
SqlJetException
-
isNull
boolean isNull(java.lang.String fieldName) throws SqlJetExceptionTests field value for null.- Returns:
- true if field value is null
- Throws:
SqlJetException
-
getString
java.lang.String getString(int field) throws SqlJetExceptionReturns specified field's value as String.- Parameters:
field- index of the field- Returns:
- field's value as string
- Throws:
SqlJetException
-
getString
java.lang.String getString(java.lang.String fieldName) throws SqlJetExceptionReturns specified field's value as String.- Parameters:
fieldName- name of the field- Returns:
- field's value as string
- Throws:
SqlJetException
-
getInteger
long getInteger(int field) throws SqlJetExceptionReturns specified field's value as integer.- Parameters:
field- index of the field- Returns:
- field's value as integer
- Throws:
SqlJetException
-
getInteger
long getInteger(java.lang.String fieldName) throws SqlJetExceptionReturns specified field's value as integer.- Parameters:
fieldName- name of the field- Throws:
SqlJetException
-
getFloat
double getFloat(int field) throws SqlJetExceptionReturns specified field's value as float.- Parameters:
field- index of the field- Returns:
- field's value as real
- Throws:
SqlJetException
-
getFloat
double getFloat(java.lang.String fieldName) throws SqlJetExceptionReturns specified field's value as float.- Parameters:
fieldName- name of the field- Throws:
SqlJetException
-
getBoolean
boolean getBoolean(int field) throws SqlJetExceptionReturns specified field's value as boolean.- Parameters:
field- index of the field- Returns:
- field value
- Throws:
SqlJetException
-
getBoolean
boolean getBoolean(java.lang.String fieldName) throws SqlJetExceptionReturns specified field's value as boolean.- Parameters:
fieldName- name of the field- Returns:
- field value
- Throws:
SqlJetException
-
getBlobAsArray
byte[] getBlobAsArray(int field) throws SqlJetExceptionReturns specified field's value as BLOB.- Parameters:
field- index of the field- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getBlobAsArray
byte[] getBlobAsArray(java.lang.String fieldName) throws SqlJetExceptionReturns specified field's value as BLOB.- Parameters:
fieldName- name of the field- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getBlobAsStream
java.io.InputStream getBlobAsStream(int field) throws SqlJetExceptionReturns specified field's value as BLOB.- Parameters:
field- number of field begin from zero- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getBlobAsStream
java.io.InputStream getBlobAsStream(java.lang.String fieldName) throws SqlJetExceptionReturns specified field's value as BLOB.- Parameters:
fieldName- name of the field- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getValue
java.lang.Object getValue(int field) throws SqlJetExceptionReturns value of the field of the specified index in the current row.- Parameters:
field- index of the field- Throws:
SqlJetException
-
getValue
java.lang.Object getValue(java.lang.String fieldName) throws SqlJetExceptionReturns value of the field with the specified name in the current row.- Parameters:
fieldName- name of the field- Throws:
SqlJetException
-
getRowValues
java.lang.Object[] getRowValues() throws SqlJetExceptionReturns all field values of current row.- Returns:
- field values array
- Throws:
SqlJetException
-
update
void update(java.lang.Object... values) throws SqlJetExceptionUpdates the current record.- Parameters:
values- New record values.- Throws:
SqlJetException
-
updateWithRowId
long updateWithRowId(long rowId, java.lang.Object... values) throws SqlJetExceptionUpdates rowId and values in the current record.- Parameters:
values- New record values.- Throws:
SqlJetException
-
updateByFieldNames
void updateByFieldNames(java.util.Map<java.lang.String,java.lang.Object> values) throws SqlJetExceptionUpdates the current record.- Parameters:
values- New record values mapped by field names.- Throws:
SqlJetException
-
updateOr
void updateOr(SqlJetConflictAction onConflict, java.lang.Object... values) throws SqlJetException
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, java.lang.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, java.util.Map<java.lang.String,java.lang.Object> values) throws SqlJetException
Updates the current record. Implements ON CONFLICT clause. SeeSqlJetConflictAction.- Parameters:
onConflict-SqlJetConflictAction.values- New record values mapped by field names.- Throws:
SqlJetException
-
delete
void delete() throws SqlJetExceptionDeletes the current record.- Throws:
SqlJetException
-
reverse
ISqlJetCursor reverse() throws SqlJetException
Returns cursor with the order reversed.- Returns:
- cursor that will traverse the same rows as this one, but in reversed order.
- Throws:
SqlJetException
-
getRowCount
long getRowCount() throws SqlJetExceptionReturns number of rows accessible with this cursor.- Returns:
- number of rows
- Throws:
SqlJetException
-
getRowIndex
long getRowIndex() throws SqlJetExceptionReturns 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
boolean goToRow(long rowIndex) throws SqlJetExceptionGoes 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
void setLimit(long limit) throws SqlJetExceptionSets 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.
-
-