Class SqlJetBtreeDataTable
- java.lang.Object
-
- org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
-
- org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeDataTable
-
- All Implemented Interfaces:
ISqlJetBtreeDataTable
,ISqlJetBtreeTable
public class SqlJetBtreeDataTable extends SqlJetBtreeTable implements ISqlJetBtreeDataTable
- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
-
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
Constructors Constructor Description SqlJetBtreeDataTable(ISqlJetBtree btree, java.lang.String tableName, boolean write)
Open data table by name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.lang.Object... values)
Write an new entry into the table.long
insert(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)
Insert record by values by names of fields.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.lang.Object... values)
Update an entry in the table by rowId.void
update(SqlJetConflictAction onConflict, long rowId, java.util.Map<java.lang.String,java.lang.Object> values)
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
adjustKeyInfo, 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 interfaceISqlJetBtreeTable
- Overrides:
close
in classSqlJetBtreeTable
- Throws:
SqlJetException
-
getDefinition
public ISqlJetTableDef getDefinition()
Description copied from interface:ISqlJetBtreeDataTable
Get table's schema definition.- Specified by:
getDefinition
in interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- Returns:
- Throws:
SqlJetException
-
getRowId
public long getRowId() throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTable
Get current rowID.- Specified by:
getRowId
in interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- Throws:
SqlJetException
-
insertWithRowId
public long insertWithRowId(SqlJetConflictAction onConflict, long rowId, java.lang.Object[] values) throws SqlJetException
- Specified by:
insertWithRowId
in interfaceISqlJetBtreeDataTable
- Returns:
- Throws:
SqlJetException
-
newRowId
public long newRowId() throws SqlJetException
- Specified by:
newRowId
in interfaceISqlJetBtreeTable
- Overrides:
newRowId
in classSqlJetBtreeTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- Throws:
SqlJetException
-
delete
public void delete() throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTable
Delete curent record.- Specified by:
delete
in interfaceISqlJetBtreeDataTable
- Specified by:
delete
in interfaceISqlJetBtreeTable
- Overrides:
delete
in classSqlJetBtreeTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeDataTable
- Throws:
SqlJetException
-
update
public void update(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values) throws SqlJetException
- Specified by:
update
in interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeTable
- Overrides:
getInteger
in classSqlJetBtreeTable
- 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 interfaceISqlJetBtreeTable
- Overrides:
getValue
in classSqlJetBtreeTable
- Returns:
- Throws:
SqlJetException
-
isIndexExists
public boolean isIndexExists(java.lang.String indexName)
- Specified by:
isIndexExists
in interfaceISqlJetBtreeDataTable
- 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 interfaceISqlJetBtreeTable
- Overrides:
clear
in classSqlJetBtreeTable
- Throws:
SqlJetException
-
getValueMem
protected ISqlJetVdbeMem getValueMem(int field) throws SqlJetException
- Overrides:
getValueMem
in classSqlJetBtreeTable
- Throws:
SqlJetException
-
getIndex
public ISqlJetBtreeIndexTable getIndex(java.lang.String indexName)
- Specified by:
getIndex
in interfaceISqlJetBtreeDataTable
- Returns:
-
isNull
public boolean isNull(int field) throws SqlJetException
Description copied from interface:ISqlJetBtreeTable
Check to field has null value.- Specified by:
isNull
in interfaceISqlJetBtreeTable
- Overrides:
isNull
in classSqlJetBtreeTable
- Parameters:
field
- number of field begin from zero- Returns:
- true if field value is null
- Throws:
SqlJetException
-
-