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
-
-
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 booleancheckIndex(java.lang.String indexName, java.lang.Object[] key)Check the current record is equal to key using definition of index.voidclear()voidclose()Close B-Tree table cursor.voiddelete()Delete curent record.voiddelete(long rowId)Delete record by row's ID.ISqlJetTableDefgetDefinition()Get table's schema definition.ISqlJetBtreeIndexTablegetIndex(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.longgetInteger(int field)Get field's value as integer.java.lang.Object[]getKeyForIndex(java.lang.Object[] fields, ISqlJetIndexDef indexDef)java.lang.StringgetPrimaryKeyIndex()Get name of index which has been auto-created for primary key.longgetRowId()Get current rowID.static longgetRowIdFromValues(java.util.Map<java.lang.String,java.lang.Object> values)java.lang.ObjectgetValue(int field)Get value as object.protected ISqlJetVdbeMemgetValueMem(int field)booleangoToRow(long rowId)Go to record with given rowID.longinsert(SqlJetConflictAction onConflict, java.lang.Object... values)Write an new entry into the table.longinsert(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)Insert record by values by names of fields.longinsertWithRowId(SqlJetConflictAction onConflict, long rowId, java.lang.Object[] values)static booleanisFieldNameRowId(java.lang.String fieldName)booleanisIndexExists(java.lang.String indexName)booleanisNull(int field)Check to field has null value.booleanlocate(java.lang.String indexName, boolean next, java.lang.Object... key)Locate record which using index by key.longnewRowId()voidupdate(SqlJetConflictAction onConflict, long rowId, java.lang.Object... values)Update an entry in the table by rowId.voidupdate(SqlJetConflictAction onConflict, long rowId, java.util.Map<java.lang.String,java.lang.Object> values)voidupdate(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values)voidupdateCurrent(SqlJetConflictAction onConflict, java.lang.Object... values)Update the current entry in the table.longupdateCurrentWithRowId(SqlJetConflictAction onConflict, long newRowId, java.lang.Object... values)Update the rowId and values in current entry in the table.longupdateWithRowId(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 SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableClose B-Tree table cursor.- Specified by:
closein interfaceISqlJetBtreeTable- Overrides:
closein classSqlJetBtreeTable- Throws:
SqlJetException
-
getDefinition
public ISqlJetTableDef getDefinition()
Description copied from interface:ISqlJetBtreeDataTableGet table's schema definition.- Specified by:
getDefinitionin interfaceISqlJetBtreeDataTable- Returns:
- the tableDef
-
getIndexDefinitions
public java.util.Map<java.lang.String,ISqlJetIndexDef> getIndexDefinitions()
Description copied from interface:ISqlJetBtreeDataTableGet definitions of table's indexes.- Specified by:
getIndexDefinitionsin interfaceISqlJetBtreeDataTable- Returns:
- the indexesDefs
-
goToRow
public boolean goToRow(long rowId) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeDataTableGo to record with given rowID. Return boolean to indicate success.- Specified by:
goToRowin interfaceISqlJetBtreeDataTable- Returns:
- Throws:
SqlJetException
-
getRowId
public long getRowId() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeDataTableGet current rowID.- Specified by:
getRowIdin interfaceISqlJetBtreeDataTable- Returns:
- Throws:
SqlJetException
-
insert
public long insert(SqlJetConflictAction onConflict, java.lang.Object... values) throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTableWrite an new entry into the table.- Specified by:
insertin interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
insertWithRowId
public long insertWithRowId(SqlJetConflictAction onConflict, long rowId, java.lang.Object[] values) throws SqlJetException
- Specified by:
insertWithRowIdin interfaceISqlJetBtreeDataTable- Returns:
- Throws:
SqlJetException
-
newRowId
public long newRowId() throws SqlJetException- Specified by:
newRowIdin interfaceISqlJetBtreeTable- Overrides:
newRowIdin classSqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
update
public void update(SqlJetConflictAction onConflict, long rowId, java.lang.Object... values) throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTableUpdate an entry in the table by rowId.- Specified by:
updatein interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
updateCurrent
public void updateCurrent(SqlJetConflictAction onConflict, java.lang.Object... values) throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTableUpdate the current entry in the table.- Specified by:
updateCurrentin interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
updateWithRowId
public long updateWithRowId(SqlJetConflictAction onConflict, long rowId, long newRowId, java.lang.Object... values) throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTableUpdate the rowId and values an entry in the table by rowId.- Specified by:
updateWithRowIdin interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
updateCurrentWithRowId
public long updateCurrentWithRowId(SqlJetConflictAction onConflict, long newRowId, java.lang.Object... values) throws SqlJetException
Description copied from interface:ISqlJetBtreeDataTableUpdate the rowId and values in current entry in the table.- Specified by:
updateCurrentWithRowIdin interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
delete
public void delete(long rowId) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeDataTableDelete record by row's ID.- Specified by:
deletein interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
delete
public void delete() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeDataTableDelete curent record.- Specified by:
deletein interfaceISqlJetBtreeDataTable- Specified by:
deletein interfaceISqlJetBtreeTable- Overrides:
deletein 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 SqlJetExceptionDescription copied from interface:ISqlJetBtreeDataTableCheck the current record is equal to key using definition of index.- Specified by:
checkIndexin interfaceISqlJetBtreeDataTable- Returns:
- Throws:
SqlJetException
-
getPrimaryKeyIndex
public java.lang.String getPrimaryKeyIndex()
Description copied from interface:ISqlJetBtreeDataTableGet name of index which has been auto-created for primary key.- Specified by:
getPrimaryKeyIndexin interfaceISqlJetBtreeDataTable- Returns:
- the primaryKeyIndex
-
locate
public boolean locate(java.lang.String indexName, boolean next, java.lang.Object... key) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeDataTableLocate 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:
locatein interfaceISqlJetBtreeDataTable- Returns:
- Throws:
SqlJetException
-
getIndexesTables
public java.util.Map<java.lang.String,ISqlJetBtreeIndexTable> getIndexesTables()
Description copied from interface:ISqlJetBtreeDataTableGet indexes which are related with table.- Specified by:
getIndexesTablesin 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:ISqlJetBtreeDataTableInsert record by values by names of fields.- Specified by:
insertin 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:
updatein interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
update
public void update(SqlJetConflictAction onConflict, java.util.Map<java.lang.String,java.lang.Object> values) throws SqlJetException
- Specified by:
updatein interfaceISqlJetBtreeDataTable- Throws:
SqlJetException
-
getInteger
public long getInteger(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet field's value as integer.- Specified by:
getIntegerin interfaceISqlJetBtreeTable- Overrides:
getIntegerin 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 SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet value as object.- Specified by:
getValuein interfaceISqlJetBtreeTable- Overrides:
getValuein classSqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
isIndexExists
public boolean isIndexExists(java.lang.String indexName)
- Specified by:
isIndexExistsin 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:
clearin interfaceISqlJetBtreeTable- Overrides:
clearin classSqlJetBtreeTable- Throws:
SqlJetException
-
getValueMem
protected ISqlJetVdbeMem getValueMem(int field) throws SqlJetException
- Overrides:
getValueMemin classSqlJetBtreeTable- Throws:
SqlJetException
-
getIndex
public ISqlJetBtreeIndexTable getIndex(java.lang.String indexName)
- Specified by:
getIndexin interfaceISqlJetBtreeDataTable- Returns:
-
isNull
public boolean isNull(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableCheck to field has null value.- Specified by:
isNullin interfaceISqlJetBtreeTable- Overrides:
isNullin classSqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- true if field value is null
- Throws:
SqlJetException
-
-