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

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

public class SqlJetBtreeIndexTable
extends SqlJetBtreeTable
implements ISqlJetBtreeIndexTable


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
SqlJetBtreeIndexTable(ISqlJetBtree btree, java.lang.String indexName, boolean write)
          Open index by name
SqlJetBtreeIndexTable(ISqlJetBtree btree, java.lang.String indexName, java.util.List<java.lang.String> columns, boolean write)
           
 
Method Summary
 boolean checkKey(java.lang.Object... key)
          Check current record against key.
 int compareKey(java.lang.Object[] key)
           
 int compareKeys(java.lang.Object[] firstKey, java.lang.Object[] lastKey)
           
 boolean delete(long rowId, java.lang.Object... key)
          Delete entry which matches to key and point to given rowId.
 ISqlJetIndexDef getIndexDef()
           
 long getKeyRowId()
           
 void insert(long rowId, boolean append, java.lang.Object... key)
          Writes key into the index.
 long lookup(boolean next, java.lang.Object... values)
          Lookup index entry by key values.
 long lookupLastNear(java.lang.Object[] key)
           
 long lookupNear(boolean next, java.lang.Object[] key)
           
 void reindex(ISqlJetSchema schema)
           
 
Methods inherited from class org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable
checkField, clear, clearRecordCache, close, delete, eof, first, getBlob, getCursor, getEncoding, getFieldsCount, getFieldType, getFloat, getInteger, getKeyInfo, getKeySize, getRecord, getString, getValue, getValueMem, getValues, getValueUncached, hasMoved, insert, isNull, last, lock, lockTable, moveTo, newRowId, 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
clear, close, delete, eof, first, getBlob, getEncoding, getFieldsCount, getFieldType, getFloat, getInteger, getKeySize, getRecord, getString, getValue, getValues, hasMoved, insert, isNull, last, lock, lockTable, moveTo, newRowId, newRowId, next, popState, previous, pushState, unlock
 

Constructor Detail

SqlJetBtreeIndexTable

public SqlJetBtreeIndexTable(ISqlJetBtree btree,
                             java.lang.String indexName,
                             boolean write)
                      throws SqlJetException
Open index by name

Throws:
SqlJetException

SqlJetBtreeIndexTable

public SqlJetBtreeIndexTable(ISqlJetBtree btree,
                             java.lang.String indexName,
                             java.util.List<java.lang.String> columns,
                             boolean write)
                      throws SqlJetException
Throws:
SqlJetException
Method Detail

getIndexDef

public ISqlJetIndexDef getIndexDef()
Returns:
the indexDef

lookup

public long lookup(boolean next,
                   java.lang.Object... values)
            throws SqlJetException
Description copied from interface: ISqlJetBtreeIndexTable
Lookup index entry by key values. If 'next' is true then just check next entry in index.

Specified by:
lookup in interface ISqlJetBtreeIndexTable
Parameters:
next - just check next index entry
values - the key values
Returns:
Throws:
SqlJetException

compareKeys

public int compareKeys(java.lang.Object[] firstKey,
                       java.lang.Object[] lastKey)
                throws SqlJetException
Specified by:
compareKeys in interface ISqlJetBtreeIndexTable
Returns:
Throws:
SqlJetException

checkKey

public boolean checkKey(java.lang.Object... key)
                 throws SqlJetException
Description copied from interface: ISqlJetBtreeIndexTable
Check current record against key.

Specified by:
checkKey in interface ISqlJetBtreeIndexTable
Returns:
Throws:
SqlJetException

insert

public void insert(long rowId,
                   boolean append,
                   java.lang.Object... key)
            throws SqlJetException
Description copied from interface: ISqlJetBtreeIndexTable
Writes key into the index. Data for the entry is nil. Append flag that provides a hint to the b-tree layer that this insert is likely to be an append.

Specified by:
insert in interface ISqlJetBtreeIndexTable
Throws:
SqlJetException

delete

public boolean delete(long rowId,
                      java.lang.Object... key)
               throws SqlJetException
Description copied from interface: ISqlJetBtreeIndexTable
Delete entry which matches to key and point to given rowId.

Specified by:
delete in interface ISqlJetBtreeIndexTable
Returns:
true if there was deleted entry which matches to key.
Throws:
SqlJetException

getKeyRowId

public long getKeyRowId()
                 throws SqlJetException
Specified by:
getKeyRowId in interface ISqlJetBtreeIndexTable
Throws:
SqlJetException

reindex

public void reindex(ISqlJetSchema schema)
             throws SqlJetException
Throws:
SqlJetException

compareKey

public int compareKey(java.lang.Object[] key)
               throws SqlJetException
Specified by:
compareKey in interface ISqlJetBtreeIndexTable
Returns:
Throws:
SqlJetException

lookupNear

public long lookupNear(boolean next,
                       java.lang.Object[] key)
                throws SqlJetException
Specified by:
lookupNear in interface ISqlJetBtreeIndexTable
Returns:
Throws:
SqlJetException

lookupLastNear

public long lookupLastNear(java.lang.Object[] key)
                    throws SqlJetException
Specified by:
lookupLastNear in interface ISqlJetBtreeIndexTable
Returns:
Throws:
SqlJetException