Class SqlJetBtreeTable
- java.lang.Object
-
- org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
-
- All Implemented Interfaces:
ISqlJetBtreeTable
- Direct Known Subclasses:
SqlJetBtreeDataTable,SqlJetBtreeIndexTable,SqlJetBtreeSchemaTable,SqlJetMapIndexCursor,SqlJetMapTableCursor
public class SqlJetBtreeTable extends java.lang.Object implements ISqlJetBtreeTable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classSqlJetBtreeTable.State
-
Field Summary
Fields Modifier and Type Field Description protected ISqlJetBtreebtreeprotected booleanindexprotected introotPageprotected booleanwrite
-
Constructor Summary
Constructors Constructor Description SqlJetBtreeTable(ISqlJetBtree btree, int rootPage, boolean write, boolean index)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadjustKeyInfo()protected static booleancheckField(ISqlJetBtreeRecord record, int field)voidclear()protected voidclearRecordCache()voidclose()Close B-Tree table cursor.voiddelete()booleaneof()Check of end of B-Tree table cursor.booleanfirst()Go to first record.ISqlJetMemoryPointergetBlob(int field)Get field's value as BLOB.protected ISqlJetBtreeCursorgetCursor()SqlJetEncodinggetEncoding()intgetFieldsCount()Get count of fields in current record.SqlJetValueTypegetFieldType(int field)Get type of field.doublegetFloat(int field)Get field's value as real (float).longgetInteger(int field)Get field's value as integer.protected SqlJetKeyInfogetKeyInfo()longgetKeySize()ISqlJetBtreeRecordgetRecord()java.lang.StringgetString(int field)Get field's value as string.java.lang.ObjectgetValue(int field)Get value as object.protected ISqlJetVdbeMemgetValueMem(int field)java.lang.Object[]getValues()Get values as objects.java.lang.ObjectgetValueUncached(int field)booleanhasMoved()Returns true if cursor has been moved.voidinsert(ISqlJetMemoryPointer pKey, long nKey, ISqlJetMemoryPointer pData, int nData, int nZero, boolean bias)booleanisNull(int field)Check to field has null value.booleanlast()Go to last record.voidlock()Lock B-Tree table cursor's mutex.voidlockTable(boolean write)intmoveTo(ISqlJetMemoryPointer pKey, long nKey, boolean bias)longnewRowId()longnewRowId(long prev)Get a new integer record number (a.k.a "rowid") used as the key to a table.booleannext()Go to next record.booleanpopState()Restores previously saved state if there any.booleanprevious()Go to previous record.voidpushState()Saves current state of this table and sets it to point to the first record.voidunlock()Unlock B-Tree table cursror's mutex.
-
-
-
Field Detail
-
btree
protected ISqlJetBtree btree
-
rootPage
protected int rootPage
-
write
protected boolean write
-
index
protected boolean index
-
-
Constructor Detail
-
SqlJetBtreeTable
public SqlJetBtreeTable(ISqlJetBtree btree, int rootPage, boolean write, boolean index) throws SqlJetException
- Parameters:
db-btree-rootPage-write-index-- Throws:
SqlJetException
-
-
Method Detail
-
getCursor
protected ISqlJetBtreeCursor getCursor()
-
getKeyInfo
protected SqlJetKeyInfo getKeyInfo()
-
pushState
public void pushState() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableSaves current state of this table and sets it to point to the first record.- Specified by:
pushStatein interfaceISqlJetBtreeTable- Throws:
SqlJetException
-
adjustKeyInfo
protected void adjustKeyInfo() throws SqlJetException- Throws:
SqlJetException
-
popState
public boolean popState() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableRestores previously saved state if there any.- Specified by:
popStatein interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
close
public void close() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableClose B-Tree table cursor.- Specified by:
closein interfaceISqlJetBtreeTable- Throws:
SqlJetException
-
unlock
public void unlock()
Description copied from interface:ISqlJetBtreeTableUnlock B-Tree table cursror's mutex.- Specified by:
unlockin interfaceISqlJetBtreeTable
-
lock
public void lock() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableLock B-Tree table cursor's mutex.- Specified by:
lockin interfaceISqlJetBtreeTable- Throws:
SqlJetException
-
eof
public boolean eof() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableCheck of end of B-Tree table cursor.- Specified by:
eofin interfaceISqlJetBtreeTable- Returns:
- true if there is not more records.
- Throws:
SqlJetException
-
hasMoved
public boolean hasMoved() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableReturns true if cursor has been moved. Side effect of this is restore position of cursor.- Specified by:
hasMovedin interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
first
public boolean first() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGo to first record.- Specified by:
firstin interfaceISqlJetBtreeTable- Returns:
- true if there is at least one record.
- Throws:
SqlJetException
-
last
public boolean last() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGo to last record.- Specified by:
lastin interfaceISqlJetBtreeTable- Returns:
- true if there is at least one record.
- Throws:
SqlJetException
-
next
public boolean next() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGo to next record.- Specified by:
nextin interfaceISqlJetBtreeTable- Returns:
- true if there is at least one record and end of cursor is not reached yet
- Throws:
SqlJetException
-
previous
public boolean previous() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGo to previous record.- Specified by:
previousin interfaceISqlJetBtreeTable- Returns:
- true if there is at least one record and begin of cursor is not reached yet
- Throws:
SqlJetException
-
getRecord
public ISqlJetBtreeRecord getRecord() throws SqlJetException
- Specified by:
getRecordin interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
lockTable
public void lockTable(boolean write)
- Specified by:
lockTablein interfaceISqlJetBtreeTable
-
getEncoding
public SqlJetEncoding getEncoding() throws SqlJetException
- Specified by:
getEncodingin interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
checkField
protected static boolean checkField(ISqlJetBtreeRecord record, int field) throws SqlJetException
- Throws:
SqlJetException
-
getValueMem
protected ISqlJetVdbeMem getValueMem(int field) throws SqlJetException
- Throws:
SqlJetException
-
getValue
public java.lang.Object getValue(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet value as object.- Specified by:
getValuein interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
getValueUncached
public java.lang.Object getValueUncached(int field) throws SqlJetException- Throws:
SqlJetException
-
getFieldsCount
public int getFieldsCount() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet count of fields in current record.- Specified by:
getFieldsCountin interfaceISqlJetBtreeTable- Returns:
- count of fields
- Throws:
SqlJetException
-
isNull
public boolean isNull(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableCheck to field has null value.- Specified by:
isNullin interfaceISqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- true if field value is null
- Throws:
SqlJetException
-
getString
public java.lang.String getString(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet field's value as string.- Specified by:
getStringin interfaceISqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- field's value as string
- Throws:
SqlJetException
-
getInteger
public long getInteger(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet field's value as integer.- Specified by:
getIntegerin interfaceISqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- field's value as integer
- Throws:
SqlJetException
-
getFloat
public double getFloat(int field) throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet field's value as real (float).- Specified by:
getFloatin interfaceISqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- field's value as real
- Throws:
SqlJetException
-
getFieldType
public SqlJetValueType getFieldType(int field) throws SqlJetException
Description copied from interface:ISqlJetBtreeTableGet type of field.- Specified by:
getFieldTypein interfaceISqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- type of field
- Throws:
SqlJetException
-
getBlob
public ISqlJetMemoryPointer getBlob(int field) throws SqlJetException
Description copied from interface:ISqlJetBtreeTableGet field's value as BLOB.- Specified by:
getBlobin interfaceISqlJetBtreeTable- Parameters:
field- number of field begin from zero- Returns:
- field's value as BLOB
- Throws:
SqlJetException
-
getValues
public java.lang.Object[] getValues() throws SqlJetExceptionDescription copied from interface:ISqlJetBtreeTableGet values as objects.- Specified by:
getValuesin interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
newRowId
public long newRowId() throws SqlJetException- Specified by:
newRowIdin interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
newRowId
public long newRowId(long prev) throws SqlJetExceptionGet a new integer record number (a.k.a "rowid") used as the key to a table. The record number is not previously used as a key in the database table that cursor P1 points to. The new record number is written written to register P2. Prev is the largest previously generated record number. No new record numbers are allowed to be less than this value. When this value reaches its maximum, a SQLITE_FULL error is generated. This mechanism is used to help implement the AUTOINCREMENT feature.- Specified by:
newRowIdin interfaceISqlJetBtreeTable- Parameters:
prev-- Returns:
- Throws:
SqlJetException
-
clearRecordCache
protected void clearRecordCache()
-
clear
public void clear() throws SqlJetException- Specified by:
clearin interfaceISqlJetBtreeTable- Throws:
SqlJetException
-
getKeySize
public long getKeySize() throws SqlJetException- Specified by:
getKeySizein interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
moveTo
public int moveTo(ISqlJetMemoryPointer pKey, long nKey, boolean bias) throws SqlJetException
- Specified by:
moveToin interfaceISqlJetBtreeTable- Returns:
- Throws:
SqlJetException
-
insert
public void insert(ISqlJetMemoryPointer pKey, long nKey, ISqlJetMemoryPointer pData, int nData, int nZero, boolean bias) throws SqlJetException
- Specified by:
insertin interfaceISqlJetBtreeTable- Parameters:
object-rowId-pData-remaining-i-b-- Throws:
SqlJetException
-
delete
public void delete() throws SqlJetException- Specified by:
deletein interfaceISqlJetBtreeTable- Throws:
SqlJetException
-
-