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

java.lang.Object
  extended by org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
      extended by org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeDataTable
All Implemented Interfaces:
ISqlJetBtreeDataTable, ISqlJetBtreeTable

public class SqlJetBtreeDataTable
extends SqlJetBtreeTable
implements ISqlJetBtreeDataTable


Nested Class Summary
 
Nested classes/interfaces inherited from class org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
SqlJetBtreeTable.State
 
Field Summary
 
Fields inherited from class org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
btree, index, rootPage, write
 
Constructor Summary
SqlJetBtreeDataTable(ISqlJetBtree btree, java.lang.String tableName, boolean write)
          Open data table by name.
 
Method Summary
 boolean checkIndex(java.lang.String indexName, java.lang.Object[] key)
          Check the current record is equal to key using definition of index.
 void clear()
           
 void close()
          Close B-Tree table cursor.
 void delete()
          Delete curent record.
 void delete(long rowId)
          Delete record by row's ID.
 ISqlJetTableDef getDefinition()
          Get table's schema definition.
 ISqlJetBtreeIndexTable getIndex(java.lang.String indexName)
           
 java.util.Map<java.lang.String,ISqlJetIndexDef> getIndexDefinitions()
          Get definitions of table's indexes.
 java.util.Map<java.lang.String,ISqlJetBtreeIndexTable> getIndexesTables()
          Get indexes which are related with table.
 long getInteger(int field)
          Get field's value as integer.
 java.lang.Object[] getKeyForIndex(java.lang.Object[] fields, ISqlJetIndexDef indexDef)
           
 java.lang.String getPrimaryKeyIndex()
          Get name of index which has been auto-created for primary key.
 long getRowId()
          Get current rowID.
static long getRowIdFromValues(java.util.Map<java.lang.String,java.lang.Object> values)
           
 java.lang.Object getValue(int field)
          Get value as object.
protected  ISqlJetVdbeMem getValueMem(int field)
           
 boolean goToRow(long rowId)
          Go to record with given rowID.
 long insert(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)
          Insert record by values by names of fields.
 long insert(SqlJetConflictAction onConflict, java.lang.Object... values)
          Write an new entry into the table.
 long insertWithRowId(SqlJetConflictAction onConflict, long rowId, java.lang.Object[] values)
           
static boolean isFieldNameRowId(java.lang.String fieldName)
           
 boolean isIndexExists(java.lang.String indexName)
           
 boolean isNull(int field)
          Check to field has null value.
 boolean locate(java.lang.String indexName, boolean next, java.lang.Object... key)
          Locate record which using index by key.
 long newRowId()
           
 void update(SqlJetConflictAction onConflict, long rowId, java.util.Map<java.lang.String,java.lang.Object> values)
           
 void update(SqlJetConflictAction onConflict, long rowId, java.lang.Object... values)
          Update an entry in the table by rowId.
 void update(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)
           
 void updateCurrent(SqlJetConflictAction onConflict, java.lang.Object... values)
          Update the current entry in the table.
 long updateCurrentWithRowId(SqlJetConflictAction onConflict, long newRowId, java.lang.Object... values)
          Update the rowId and values in current entry in the table.
 long updateWithRowId(SqlJetConflictAction onConflict, long rowId, long newRowId, java.lang.Object... values)
          Update the rowId and values an entry in the table by rowId.
 
Methods inherited from class org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
checkField, clearRecordCache, eof, first, getBlob, getCursor, getEncoding, getFieldsCount, getFieldType, getFloat, getKeyInfo, getKeySize, getRecord, getString, getValues, getValueUncached, hasMoved, insert, last, lock, lockTable, moveTo, newRowId, next, popState, previous, pushState, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tmatesoft.sqljet.core.internal.table.ISqlJetBtreeTable
eof, first, getBlob, getEncoding, getFieldsCount, getFieldType, getFloat, getKeySize, getRecord, getString, getValues, hasMoved, insert, last, lock, lockTable, moveTo, newRowId, next, popState, previous, pushState, unlock
 

Constructor Detail

SqlJetBtreeDataTable

public SqlJetBtreeDataTable(ISqlJetBtree btree,
                            java.lang.String tableName,
                            boolean write)
                     throws SqlJetException
Open data table by name.

Throws:
SqlJetException
Method Detail

close

public void close()
           throws SqlJetException
Description copied from interface: ISqlJetBtreeTable
Close B-Tree table cursor.

Specified by:
close in interface ISqlJetBtreeTable
Overrides:
close in class SqlJetBtreeTable
Throws:
SqlJetException

getDefinition

public ISqlJetTableDef getDefinition()
Description copied from interface: ISqlJetBtreeDataTable
Get table's schema definition.

Specified by:
getDefinition in interface ISqlJetBtreeDataTable
Returns:
the tableDef

getIndexDefinitions

public java.util.Map<java.lang.String,ISqlJetIndexDef> getIndexDefinitions()
Description copied from interface: ISqlJetBtreeDataTable
Get definitions of table's indexes.

Specified by:
getIndexDefinitions in interface ISqlJetBtreeDataTable
Returns:
the indexesDefs

goToRow

public boolean goToRow(long rowId)
                throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Go to record with given rowID. Return boolean to indicate success.

Specified by:
goToRow in interface ISqlJetBtreeDataTable
Returns:
Throws:
SqlJetException

getRowId

public long getRowId()
              throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Get current rowID.

Specified by:
getRowId in interface ISqlJetBtreeDataTable
Returns:
Throws:
SqlJetException

insert

public long insert(SqlJetConflictAction onConflict,
                   java.lang.Object... values)
            throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Write an new entry into the table.

Specified by:
insert in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

insertWithRowId

public long insertWithRowId(SqlJetConflictAction onConflict,
                            long rowId,
                            java.lang.Object[] values)
                     throws SqlJetException
Specified by:
insertWithRowId in interface ISqlJetBtreeDataTable
Returns:
Throws:
SqlJetException

newRowId

public long newRowId()
              throws SqlJetException
Specified by:
newRowId in interface ISqlJetBtreeTable
Overrides:
newRowId in class SqlJetBtreeTable
Returns:
Throws:
SqlJetException

update

public void update(SqlJetConflictAction onConflict,
                   long rowId,
                   java.lang.Object... values)
            throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Update an entry in the table by rowId.

Specified by:
update in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

updateCurrent

public void updateCurrent(SqlJetConflictAction onConflict,
                          java.lang.Object... values)
                   throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Update the current entry in the table.

Specified by:
updateCurrent in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

updateWithRowId

public long updateWithRowId(SqlJetConflictAction onConflict,
                            long rowId,
                            long newRowId,
                            java.lang.Object... values)
                     throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Update the rowId and values an entry in the table by rowId.

Specified by:
updateWithRowId in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

updateCurrentWithRowId

public long updateCurrentWithRowId(SqlJetConflictAction onConflict,
                                   long newRowId,
                                   java.lang.Object... values)
                            throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Update the rowId and values in current entry in the table.

Specified by:
updateCurrentWithRowId in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

delete

public void delete(long rowId)
            throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Delete record by row's ID.

Specified by:
delete in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

delete

public void delete()
            throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Delete curent record.

Specified by:
delete in interface ISqlJetBtreeDataTable
Specified by:
delete in interface ISqlJetBtreeTable
Overrides:
delete in class SqlJetBtreeTable
Throws:
SqlJetException

getKeyForIndex

public java.lang.Object[] getKeyForIndex(java.lang.Object[] fields,
                                         ISqlJetIndexDef indexDef)

checkIndex

public boolean checkIndex(java.lang.String indexName,
                          java.lang.Object[] key)
                   throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Check the current record is equal to key using definition of index.

Specified by:
checkIndex in interface ISqlJetBtreeDataTable
Returns:
Throws:
SqlJetException

getPrimaryKeyIndex

public java.lang.String getPrimaryKeyIndex()
Description copied from interface: ISqlJetBtreeDataTable
Get name of index which has been auto-created for primary key.

Specified by:
getPrimaryKeyIndex in interface ISqlJetBtreeDataTable
Returns:
the primaryKeyIndex

locate

public boolean locate(java.lang.String indexName,
                      boolean next,
                      java.lang.Object... key)
               throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Locate record which using index by key. Key is values for fields which are defined in index. If record is found then returns true. If next is true then locate record by next entry in index for key.

Specified by:
locate in interface ISqlJetBtreeDataTable
Returns:
Throws:
SqlJetException

getIndexesTables

public java.util.Map<java.lang.String,ISqlJetBtreeIndexTable> getIndexesTables()
Description copied from interface: ISqlJetBtreeDataTable
Get indexes which are related with table.

Specified by:
getIndexesTables in interface ISqlJetBtreeDataTable
Returns:
the indexesTables

insert

public long insert(SqlJetConflictAction onConflict,
                   java.util.Map<java.lang.String,java.lang.Object> values)
            throws SqlJetException
Description copied from interface: ISqlJetBtreeDataTable
Insert record by values by names of fields.

Specified by:
insert in interface ISqlJetBtreeDataTable
Returns:
Throws:
SqlJetException

update

public void update(SqlJetConflictAction onConflict,
                   long rowId,
                   java.util.Map<java.lang.String,java.lang.Object> values)
            throws SqlJetException
Specified by:
update in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

update

public void update(SqlJetConflictAction onConflict,
                   java.util.Map<java.lang.String,java.lang.Object> values)
            throws SqlJetException
Specified by:
update in interface ISqlJetBtreeDataTable
Throws:
SqlJetException

getInteger

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

Specified by:
getInteger in interface ISqlJetBtreeTable
Overrides:
getInteger in class SqlJetBtreeTable
Parameters:
field - number of field begin from zero
Returns:
field's value as integer
Throws:
SqlJetException

getValue

public java.lang.Object getValue(int field)
                          throws SqlJetException
Description copied from interface: ISqlJetBtreeTable
Get value as object.

Specified by:
getValue in interface ISqlJetBtreeTable
Overrides:
getValue in class SqlJetBtreeTable
Returns:
Throws:
SqlJetException

isIndexExists

public boolean isIndexExists(java.lang.String indexName)
Specified by:
isIndexExists in interface ISqlJetBtreeDataTable
Returns:

isFieldNameRowId

public static boolean isFieldNameRowId(java.lang.String fieldName)

getRowIdFromValues

public static long getRowIdFromValues(java.util.Map<java.lang.String,java.lang.Object> values)
                               throws SqlJetException
Throws:
SqlJetException

clear

public void clear()
           throws SqlJetException
Specified by:
clear in interface ISqlJetBtreeTable
Overrides:
clear in class SqlJetBtreeTable
Throws:
SqlJetException

getValueMem

protected ISqlJetVdbeMem getValueMem(int field)
                              throws SqlJetException
Overrides:
getValueMem in class SqlJetBtreeTable
Throws:
SqlJetException

getIndex

public ISqlJetBtreeIndexTable getIndex(java.lang.String indexName)
Specified by:
getIndex in interface ISqlJetBtreeDataTable
Returns:

isNull

public boolean isNull(int field)
               throws SqlJetException
Description copied from interface: ISqlJetBtreeTable
Check to field has null value.

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