public abstract class BaseIndex extends SchemaObjectBase implements Index
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
columnIds |
protected Column[] |
columns |
protected IndexColumn[] |
indexColumns |
protected IndexType |
indexType |
protected Table |
table |
comment, database, trace| Modifier | Constructor and Description |
|---|---|
protected |
BaseIndex(Table newTable,
int id,
java.lang.String name,
IndexColumn[] newIndexColumns,
IndexType newIndexType)
Initialize the base index.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canFindNext()
Check if the index can get the next higher value.
|
boolean |
canScan()
Can this index iterate over all rows?
|
protected static void |
checkIndexColumnTypes(IndexColumn[] columns)
Check that the index columns are not CLOB or BLOB.
|
int |
compareKeys(SearchRow rowData,
SearchRow compare)
Compare the positions of two rows.
|
int |
compareRows(SearchRow rowData,
SearchRow compare)
Compare two rows.
|
IndexLookupBatch |
createLookupBatch(TableFilter[] filters,
int filter)
Creates new lookup batch.
|
Cursor |
find(TableFilter filter,
SearchRow first,
SearchRow last)
Find a row or a list of rows and create a cursor to iterate over the
result.
|
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
|
Column[] |
getColumns()
Get the indexed columns.
|
protected long |
getCostRangeIndex(int[] masks,
long rowCount,
TableFilter[] filters,
int filter,
SortOrder sortOrder,
boolean isScanIndex,
AllColumnsForPlan allColumnsSet)
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(java.lang.String key)
Create a duplicate key exception with a message that contains the index
name.
|
protected java.lang.StringBuilder |
getDuplicatePrimaryKeyMessage(int mainIndexColumn)
Get "PRIMARY KEY ON [(column)]".
|
IndexColumn[] |
getIndexColumns()
Get the indexed columns as index columns (with ordering information).
|
IndexType |
getIndexType()
Get the index type.
|
java.lang.String |
getPlanSQL()
Get the message to show in a EXPLAIN statement.
|
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.
|
boolean |
isFindUsingFullTableScan()
Returns
true if find() implementation performs scan over all
index, false if find() performs the fast lookup. |
boolean |
isFirstColumn(Column column)
Check if the given column is the first for this 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.
|
boolean |
isRowIdIndex()
Does this index support lookup by row id?
|
boolean |
mayHaveNullDuplicates(SearchRow searchRow)
Check if this row may have duplicates with the same indexed values in the
current compatibility mode.
|
void |
removeChildrenAndResources(Session session)
Remove all dependent objects and free all resources (files, blocks in
files) of this object.
|
void |
setSortedInsertMode(boolean sortedInsertMode)
Enable or disable the 'sorted insert' optimizations (rows are inserted in
ascending or descending order) if applicable for this index
implementation.
|
void |
update(Session session,
Row oldRow,
Row newRow)
Update index after row change.
|
getSchema, getSQL, getSQLcheckRename, getChildren, getComment, getDatabase, getId, getModificationId, getName, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, canGetFirstOrLast, close, find, findFirstOrLast, getCost, getDiskSpaceUsed, getRowCount, getRowCountApproximation, needRebuild, remove, remove, truncategetSchemacheckRename, getChildren, getComment, getDatabase, getId, getName, getSQL, getSQL, isTemporary, rename, setComment, setTemporaryprotected IndexColumn[] indexColumns
protected Column[] columns
protected int[] columnIds
protected final Table table
protected final IndexType indexType
protected BaseIndex(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 typeprotected static void checkIndexColumnTypes(IndexColumn[] columns)
columns - the columnspublic java.lang.String getDropSQL()
DbObjectBasegetDropSQL in interface DbObjectgetDropSQL in class DbObjectBasepublic DbException getDuplicateKeyException(java.lang.String key)
key - the key valuesprotected java.lang.StringBuilder getDuplicatePrimaryKeyMessage(int mainIndexColumn)