org.tmatesoft.sqljet.core.internal.table
Class SqlJetReverseOrderCursor

java.lang.Object
  extended by org.tmatesoft.sqljet.core.internal.table.SqlJetReverseOrderCursor
All Implemented Interfaces:
ISqlJetCursor

public class SqlJetReverseOrderCursor
extends java.lang.Object
implements ISqlJetCursor


Constructor Summary
SqlJetReverseOrderCursor(ISqlJetCursor cursor)
           
 
Method Summary
 void 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(java.lang.String fieldName)
          Returns specified field's value as BLOB.
 java.io.InputStream getBlobAsStream(int field)
          Returns specified field's value as BLOB.
 java.io.InputStream getBlobAsStream(java.lang.String fieldName)
          Returns specified field's value as BLOB.
 boolean getBoolean(int field)
          Returns specified field's value as boolean.
 boolean getBoolean(java.lang.String fieldName)
          Returns specified field's value as boolean.
 int getFieldsCount()
          Returns number of fields in the current record.
 SqlJetValueType getFieldType(int field)
          Returns field type.
 SqlJetValueType getFieldType(java.lang.String fieldName)
          Returns field type.
 double getFloat(int field)
          Returns specified field's value as float.
 double getFloat(java.lang.String fieldName)
          Returns specified field's value as float.
 long getInteger(int field)
          Returns specified field's value as integer.
 long getInteger(java.lang.String fieldName)
          Returns specified field's value as integer.
 long getLimit()
          Returns limit of this cursor.
 long getRowCount()
          Returns number of rows accessible with this cursor.
 long getRowId()
          Gets row Id of the current record.
 long getRowIndex()
          Returns index of the current row.
 java.lang.Object[] getRowValues()
          Returns all field values of current row.
 java.lang.String getString(int field)
          Returns specified field's value as String.
 java.lang.String getString(java.lang.String fieldName)
          Returns specified field's value as String.
 java.lang.Object getValue(int field)
          Returns value of the field of the specified index in the current row.
 java.lang.Object getValue(java.lang.String fieldName)
          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 isNull(java.lang.String fieldName)
          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.
 ISqlJetCursor reverse()
          Returns cursor with the order reversed.
 void setLimit(long limit)
          Sets limit for this cursor.
 void update(java.lang.Object... values)
          Updates the current record.
 void updateByFieldNames(java.util.Map<java.lang.String,java.lang.Object> values)
          Updates the current record.
 void updateByFieldNamesOr(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)
          Updates the current record.
 void updateOr(SqlJetConflictAction onConflict, java.lang.Object... values)
          Updates the current record.
 long updateWithRowId(long rowId, java.lang.Object... values)
          Updates rowId and values in the current record.
 long updateWithRowIdOr(SqlJetConflictAction onConflict, long rowId, java.lang.Object... values)
          Updates rowId and values in the current record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlJetReverseOrderCursor

public SqlJetReverseOrderCursor(ISqlJetCursor cursor)
                         throws SqlJetException
Throws:
SqlJetException
Method Detail

close

public void close()
           throws SqlJetException
Description copied from interface: ISqlJetCursor
Closes the cursor.

Specified by:
close in interface ISqlJetCursor
Throws:
SqlJetException

delete

public void delete()
            throws SqlJetException
Description copied from interface: ISqlJetCursor
Deletes the current record.

Specified by:
delete in interface ISqlJetCursor
Throws:
SqlJetException

eof

public boolean eof()
            throws SqlJetException
Description copied from interface: ISqlJetCursor
Tests whether this cursor is positioned behind the last record.

Specified by:
eof in interface ISqlJetCursor
Returns:
true if the cursor is not on a record and fields can't be read.
Throws:
SqlJetException

first

public boolean first()
              throws SqlJetException
Description copied from interface: ISqlJetCursor
Goes to the first record.

Specified by:
first in interface ISqlJetCursor
Returns:
true if there is at least one record.
Throws:
SqlJetException

getBlobAsArray

public byte[] getBlobAsArray(int field)
                      throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as BLOB.

Specified by:
getBlobAsArray in interface ISqlJetCursor
Parameters:
field - index of the field
Returns:
field's value as BLOB
Throws:
SqlJetException

getBlobAsArray

public byte[] getBlobAsArray(java.lang.String fieldName)
                      throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as BLOB.

Specified by:
getBlobAsArray in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Returns:
field's value as BLOB
Throws:
SqlJetException

getBlobAsStream

public java.io.InputStream getBlobAsStream(int field)
                                    throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as BLOB.

Specified by:
getBlobAsStream in interface ISqlJetCursor
Parameters:
field - number of field begin from zero
Returns:
field's value as BLOB
Throws:
SqlJetException

getBlobAsStream

public java.io.InputStream getBlobAsStream(java.lang.String fieldName)
                                    throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as BLOB.

Specified by:
getBlobAsStream in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Returns:
field's value as BLOB
Throws:
SqlJetException

getBoolean

public boolean getBoolean(int field)
                   throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as boolean.

Specified by:
getBoolean in interface ISqlJetCursor
Parameters:
field - index of the field
Returns:
field value
Throws:
SqlJetException

getBoolean

public boolean getBoolean(java.lang.String fieldName)
                   throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as boolean.

Specified by:
getBoolean in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Returns:
field value
Throws:
SqlJetException

getFieldType

public SqlJetValueType getFieldType(int field)
                             throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns field type.

Specified by:
getFieldType in interface ISqlJetCursor
Parameters:
field - index of the field
Returns:
type of field
Throws:
SqlJetException

getFieldType

public SqlJetValueType getFieldType(java.lang.String fieldName)
                             throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns field type.

Specified by:
getFieldType in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Returns:
type of field
Throws:
SqlJetException

getFieldsCount

public int getFieldsCount()
                   throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns number of fields in the current record.

Specified by:
getFieldsCount in interface ISqlJetCursor
Throws:
SqlJetException

getFloat

public double getFloat(int field)
                throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as float.

Specified by:
getFloat in interface ISqlJetCursor
Parameters:
field - index of the field
Returns:
field's value as real
Throws:
SqlJetException

getFloat

public double getFloat(java.lang.String fieldName)
                throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as float.

Specified by:
getFloat in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Throws:
SqlJetException

getInteger

public long getInteger(int field)
                throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as integer.

Specified by:
getInteger in interface ISqlJetCursor
Parameters:
field - index of the field
Returns:
field's value as integer
Throws:
SqlJetException

getInteger

public long getInteger(java.lang.String fieldName)
                throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as integer.

Specified by:
getInteger in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Throws:
SqlJetException

getRowId

public long getRowId()
              throws SqlJetException
Description copied from interface: ISqlJetCursor
Gets row Id of the current record.

Specified by:
getRowId in interface ISqlJetCursor
Returns:
row Id of the current record.
Throws:
SqlJetException

getString

public java.lang.String getString(int field)
                           throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as String.

Specified by:
getString in interface ISqlJetCursor
Parameters:
field - index of the field
Returns:
field's value as string
Throws:
SqlJetException

getString

public java.lang.String getString(java.lang.String fieldName)
                           throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns specified field's value as String.

Specified by:
getString in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Returns:
field's value as string
Throws:
SqlJetException

getValue

public java.lang.Object getValue(int field)
                          throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns value of the field of the specified index in the current row.

Specified by:
getValue in interface ISqlJetCursor
Parameters:
field - index of the field
Throws:
SqlJetException

getValue

public java.lang.Object getValue(java.lang.String fieldName)
                          throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns value of the field with the specified name in the current row.

Specified by:
getValue in interface ISqlJetCursor
Parameters:
fieldName - name of the field
Throws:
SqlJetException

goTo

public boolean goTo(long rowId)
             throws SqlJetException
Description copied from interface: ISqlJetCursor
Goes to the record with the specified row Id.

Specified by:
goTo in interface ISqlJetCursor
Parameters:
rowId - row Id
Returns:
true if cursor was moved successfully.
Throws:
SqlJetException

isNull

public boolean isNull(int field)
               throws SqlJetException
Description copied from interface: ISqlJetCursor
Tests field value for null.

Specified by:
isNull in interface ISqlJetCursor
Parameters:
field - number of field begin from zero
Returns:
true if field value is null
Throws:
SqlJetException

isNull

public boolean isNull(java.lang.String fieldName)
               throws SqlJetException
Description copied from interface: ISqlJetCursor
Tests field value for null.

Specified by:
isNull in interface ISqlJetCursor
Returns:
true if field value is null
Throws:
SqlJetException

last

public boolean last()
             throws SqlJetException
Description copied from interface: ISqlJetCursor
Goes to the last record.

Specified by:
last in interface ISqlJetCursor
Returns:
true if there is at least one record.
Throws:
SqlJetException

next

public boolean next()
             throws SqlJetException
Description copied from interface: ISqlJetCursor
Goes to the next record.

Specified by:
next in interface ISqlJetCursor
Returns:
true if there is at least one record and end of cursor is not reached yet
Throws:
SqlJetException

previous

public boolean previous()
                 throws SqlJetException
Description copied from interface: ISqlJetCursor
Goes to the previous record.

Specified by:
previous in interface ISqlJetCursor
Returns:
true if there is at least one record and begin of cursor is not reached yet
Throws:
SqlJetException

update

public void update(java.lang.Object... values)
            throws SqlJetException
Description copied from interface: ISqlJetCursor
Updates the current record.

Specified by:
update in interface ISqlJetCursor
Parameters:
values - New record values.
Throws:
SqlJetException

updateOr

public void updateOr(SqlJetConflictAction onConflict,
                     java.lang.Object... values)
              throws SqlJetException
Description copied from interface: ISqlJetCursor
Updates the current record. Implements ON CONFLICT clause. See SqlJetConflictAction.

Specified by:
updateOr in interface ISqlJetCursor
Parameters:
onConflict - SqlJetConflictAction.
values - New record values.
Throws:
SqlJetException

updateByFieldNames

public void updateByFieldNames(java.util.Map<java.lang.String,java.lang.Object> values)
                        throws SqlJetException
Description copied from interface: ISqlJetCursor
Updates the current record.

Specified by:
updateByFieldNames in interface ISqlJetCursor
Parameters:
values - New record values mapped by field names.
Throws:
SqlJetException

updateByFieldNamesOr

public void updateByFieldNamesOr(SqlJetConflictAction onConflict,
                                 java.util.Map<java.lang.String,java.lang.Object> values)
                          throws SqlJetException
Description copied from interface: ISqlJetCursor
Updates the current record. Implements ON CONFLICT clause. See SqlJetConflictAction.

Specified by:
updateByFieldNamesOr in interface ISqlJetCursor
Parameters:
onConflict - SqlJetConflictAction.
values - New record values mapped by field names.
Throws:
SqlJetException

updateWithRowId

public long updateWithRowId(long rowId,
                            java.lang.Object... values)
                     throws SqlJetException
Description copied from interface: ISqlJetCursor
Updates rowId and values in the current record.

Specified by:
updateWithRowId in interface ISqlJetCursor
values - New record values.
Throws:
SqlJetException

updateWithRowIdOr

public long updateWithRowIdOr(SqlJetConflictAction onConflict,
                              long rowId,
                              java.lang.Object... values)
                       throws SqlJetException
Description copied from interface: ISqlJetCursor
Updates rowId and values in the current record. Implements ON CONFLICT clause. See SqlJetConflictAction.

Specified by:
updateWithRowIdOr in interface ISqlJetCursor
Parameters:
onConflict - SqlJetConflictAction.
values - New record values.
Throws:
SqlJetException

reverse

public ISqlJetCursor reverse()
                      throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns cursor with the order reversed.

Specified by:
reverse in interface ISqlJetCursor
Returns:
cursor that will traverse the same rows as this one, but in reversed order.
Throws:
SqlJetException

getRowIndex

public long getRowIndex()
                 throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns index of the current row. Index is 1-based, first record has index of one.

Specified by:
getRowIndex in interface ISqlJetCursor
Returns:
1-based index of the current row.
Throws:
SqlJetException

getRowCount

public long getRowCount()
                 throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns number of rows accessible with this cursor.

Specified by:
getRowCount in interface ISqlJetCursor
Returns:
number of rows
Throws:
SqlJetException

goToRow

public boolean goToRow(long rowIndex)
                throws SqlJetException
Description copied from interface: ISqlJetCursor
Goes to the row with the specified index. Index is 1-based, first record has index of one.

Specified by:
goToRow in interface ISqlJetCursor
Returns:
true if cursor has been set on the specified record.
Throws:
SqlJetException

getLimit

public long getLimit()
Description copied from interface: ISqlJetCursor
Returns limit of this cursor.

Specified by:
getLimit in interface ISqlJetCursor
Returns:
limit of this cursor or zero if limit has not been set.

setLimit

public void setLimit(long limit)
              throws SqlJetException
Description copied from interface: ISqlJetCursor
Sets limit for this cursor. Negative or zero value resets limit to infinity.

Specified by:
setLimit in interface ISqlJetCursor
Parameters:
limit - limit to set or zero to drop the limit.
Throws:
SqlJetException

getRowValues

public java.lang.Object[] getRowValues()
                                throws SqlJetException
Description copied from interface: ISqlJetCursor
Returns all field values of current row.

Specified by:
getRowValues in interface ISqlJetCursor
Returns:
field values array
Throws:
SqlJetException