|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.engine.DbObjectBase
org.h2.schema.SchemaObjectBase
org.h2.index.BaseIndex
public abstract class BaseIndex
Most index implementations extend the base index.
Field Summary | |
---|---|
protected int[] |
columnIds
|
protected Column[] |
columns
|
protected IndexColumn[] |
indexColumns
|
protected IndexType |
indexType
|
protected boolean |
isMultiVersion
|
protected Table |
table
|
Fields inherited from class org.h2.engine.DbObjectBase |
---|
comment, database, trace |
Fields inherited from interface org.h2.engine.DbObject |
---|
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE |
Constructor Summary | |
---|---|
BaseIndex()
|
Method Summary | |
---|---|
abstract void |
add(Session session,
Row row)
Add a row to this index. |
boolean |
canFindNext()
Check if the index can get the next higher value. |
abstract boolean |
canGetFirstOrLast()
Check if this index can quickly find the first or last value. |
abstract void |
close(Session session)
Close this index. |
void |
commit(int operation,
Row row)
Commit the operation for a row. |
int |
compareKeys(SearchRow rowData,
SearchRow compare)
Compare the positions of two rows. |
int |
compareRows(SearchRow rowData,
SearchRow compare)
Compare two rows. |
boolean |
containsNullAndAllowMultipleNull(SearchRow newRow)
Check if one of the columns is NULL and multiple rows with NULL are allowed using the current compatibility mode for unique indexes. |
abstract Cursor |
find(Session session,
SearchRow first,
SearchRow last)
Create a cursor to iterate over a number of rows. |
abstract Cursor |
findFirstOrLast(Session session,
boolean first)
Find the first (or last) value of this index. |
Cursor |
findNext(Session session,
SearchRow higherThan,
SearchRow last)
Find a row or a list of rows that is larger and create a cursor to iterate over the result. |
int |
getColumnIndex(Column col)
Get the index of a column in the list of index columns |
java.lang.String |
getColumnListSQL()
Get the list of columns as a string. |
Column[] |
getColumns()
Get the indexed columns. |
abstract double |
getCost(Session session,
int[] masks)
Calculate the cost to find rows. |
long |
getCostRangeIndex(int[] masks,
long rowCount)
Calculate the cost for the given mask as if this index was a typical b-tree range index. |
java.lang.String |
getCreateSQL()
Build a SQL statement to re-create this object. |
java.lang.String |
getCreateSQLForCopy(Table targetTable,
java.lang.String quotedName)
Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table |
java.lang.String |
getDropSQL()
Build a SQL statement to drop this object. |
DbException |
getDuplicateKeyException()
Create a duplicate key exception with a message that contains the index name |
IndexColumn[] |
getIndexColumns()
Get the indexed columns as index columns (with ordering information). |
IndexType |
getIndexType()
Get the index type. |
int |
getLookupCost(long rowCount)
Estimate the cost required to search a number of rows. |
java.lang.String |
getPlanSQL()
Get the message to show in a EXPLAIN statement. |
int |
getRootPageId()
Get the root page of this index. |
Row |
getRow(Session session,
long key)
Get the row with the given key. |
Table |
getTable()
Get the table on which this index is based. |
int |
getType()
Get the object type. |
protected void |
initBaseIndex(Table newTable,
int id,
java.lang.String name,
IndexColumn[] newIndexColumns,
IndexType newIndexType)
Initialize the base index. |
boolean |
isHidden()
Check whether this is a hidden object that doesn't appear in the meta data and in the script, and is not dropped on DROP ALL OBJECTS. |
abstract boolean |
needRebuild()
Check if this index needs to be re-built. |
abstract void |
remove(Session session)
Remove the index. |
abstract void |
remove(Session session,
Row row)
Remove a row from the index. |
void |
removeChildrenAndResources(Session session)
Remove all dependent objects and free all resources (files, blocks in files) of this object. |
abstract void |
truncate(Session session)
Truncate the index. |
Methods inherited from class org.h2.schema.SchemaObjectBase |
---|
getSchema, getSQL, initSchemaObjectBase |
Methods inherited from class org.h2.engine.DbObjectBase |
---|
checkRename, getChildren, getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.h2.index.Index |
---|
getRowCount, getRowCountApproximation |
Methods inherited from interface org.h2.schema.SchemaObject |
---|
getSchema |
Methods inherited from interface org.h2.engine.DbObject |
---|
checkRename, getChildren, getComment, getDatabase, getId, getModificationId, getName, getSQL, isTemporary, rename, setComment, setModified, setTemporary |
Field Detail |
---|
protected IndexColumn[] indexColumns
protected Column[] columns
protected int[] columnIds
protected Table table
protected IndexType indexType
protected boolean isMultiVersion
Constructor Detail |
---|
public BaseIndex()
Method Detail |
---|
protected void initBaseIndex(Table newTable, int id, java.lang.String name, IndexColumn[] newIndexColumns, IndexType newIndexType)
newTable
- the tableid
- the object idname
- the index namenewIndexColumns
- the columns that are indexed or null if this is
not yet knownnewIndexType
- the index typepublic int getRootPageId()
Index
getRootPageId
in interface Index
public abstract void close(Session session)
close
in interface Index
session
- the sessionpublic abstract void add(Session session, Row row)
add
in interface Index
session
- the sessionrow
- the row to addpublic abstract void remove(Session session, Row row)
remove
in interface Index
session
- the sessionrow
- the rowpublic abstract Cursor find(Session session, SearchRow first, SearchRow last)
find
in interface Index
session
- the sessionfirst
- the first row to return (null if no limit)last
- the last row to return (null if no limit)
public abstract double getCost(Session session, int[] masks)
getCost
in interface Index
session
- the sessionmasks
- the condition mask
public abstract void remove(Session session)
remove
in interface Index
session
- the sessionpublic abstract void truncate(Session session)
truncate
in interface Index
session
- the sessionpublic abstract boolean canGetFirstOrLast()
canGetFirstOrLast
in interface Index
public abstract Cursor findFirstOrLast(Session session, boolean first)
findFirstOrLast
in interface Index
session
- the sessionfirst
- true for the first value, false for the last
public abstract boolean needRebuild()
needRebuild
in interface Index
public java.lang.String getDropSQL()
DbObjectBase
getDropSQL
in interface DbObject
getDropSQL
in class DbObjectBase
public DbException getDuplicateKeyException()
Index
getDuplicateKeyException
in interface Index
public java.lang.String getPlanSQL()
Index
getPlanSQL
in interface Index
public void removeChildrenAndResources(Session session)
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class DbObjectBase
session
- the sessionpublic boolean canFindNext()
Index
canFindNext
in interface Index
public Cursor findNext(Session session, SearchRow higherThan, SearchRow last)
findNext
in interface Index
session
- the sessionhigherThan
- the lower limit (excluding)last
- the last row, or null for no limit
SQLException
public int getLookupCost(long rowCount)
Index
getLookupCost
in interface Index
rowCount
- the row count
public long getCostRangeIndex(int[] masks, long rowCount)
getCostRangeIndex
in interface Index
masks
- the search maskrowCount
- the number of rows in the index
public int compareRows(SearchRow rowData, SearchRow compare)
Index
compareRows
in interface Index
rowData
- the first rowcompare
- the second row
public boolean containsNullAndAllowMultipleNull(SearchRow newRow)
Index
containsNullAndAllowMultipleNull
in interface Index
newRow
- the row to check
public int compareKeys(SearchRow rowData, SearchRow compare)
Index
compareKeys
in interface Index
rowData
- the first rowcompare
- the second row
public int getColumnIndex(Column col)
Index
getColumnIndex
in interface Index
col
- the column
public java.lang.String getColumnListSQL()
Index
getColumnListSQL
in interface Index
public java.lang.String getCreateSQLForCopy(Table targetTable, java.lang.String quotedName)
DbObjectBase
getCreateSQLForCopy
in interface DbObject
getCreateSQLForCopy
in class DbObjectBase
targetTable
- the new table namequotedName
- the new quoted name
public java.lang.String getCreateSQL()
DbObjectBase
getCreateSQL
in interface DbObject
getCreateSQL
in class DbObjectBase
public IndexColumn[] getIndexColumns()
Index
getIndexColumns
in interface Index
public Column[] getColumns()
Index
getColumns
in interface Index
public IndexType getIndexType()
Index
getIndexType
in interface Index
public int getType()
DbObjectBase
getType
in interface DbObject
getType
in class DbObjectBase
public Table getTable()
Index
getTable
in interface Index
public void commit(int operation, Row row)
Index
commit
in interface Index
operation
- the operation typerow
- the rowpublic Row getRow(Session session, long key)
Index
getRow
in interface Index
session
- the sessionkey
- the unique key
public boolean isHidden()
SchemaObject
isHidden
in interface SchemaObject
isHidden
in class SchemaObjectBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |