public class IndexImpl extends Object implements Index, Comparable<IndexImpl>
Modifier and Type | Class and Description |
---|---|
static class |
IndexImpl.ForeignKeyReference
Information about a foreign key reference defined in an index (when
referential integrity should be enforced).
|
Index.Column
Modifier and Type | Field and Description |
---|---|
static byte |
FOREIGN_KEY_INDEX_TYPE
index type for foreign key indexes
|
protected static org.apache.commons.logging.Log |
LOG |
static byte |
PRIMARY_KEY_INDEX_TYPE
index type for primary key indexes
|
Modifier | Constructor and Description |
---|---|
protected |
IndexImpl(ByteBuffer tableBuffer,
List<IndexData> indexDatas,
JetFormat format) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IndexImpl other) |
Object[] |
constructIndexRow(Map<String,?> row)
Constructs an array of values appropriate for this index from the given
column values.
|
Object[] |
constructIndexRow(String colName,
Object value)
Constructs an array of values appropriate for this index from the given
column value.
|
Object[] |
constructIndexRowFromEntry(Object... values)
Constructs an array of values appropriate for this index from the given
column values, expected to match the columns for this index.
|
IndexData.EntryCursor |
cursor()
Gets a new cursor for this index.
|
IndexData.EntryCursor |
cursor(Object[] startRow,
boolean startInclusive,
Object[] endRow,
boolean endInclusive)
Gets a new cursor for this index, narrowed to the range defined by the
given startRow and endRow.
|
List<IndexData.ColumnDescriptor> |
getColumns() |
JetFormat |
getFormat() |
IndexData |
getIndexData() |
byte |
getIndexFlags() |
int |
getIndexNumber() |
String |
getName() |
PageChannel |
getPageChannel() |
IndexImpl.ForeignKeyReference |
getReference() |
IndexImpl |
getReferencedIndex() |
TableImpl |
getTable() |
int |
getUniqueEntryCount() |
int |
getUniqueEntryCountOffset() |
void |
initialize()
Forces initialization of this index (actual parsing of index pages).
|
boolean |
isForeignKey() |
boolean |
isInitialized()
Whether or not the complete index state has been read.
|
boolean |
isPrimaryKey() |
boolean |
isUnique()
Whether or not index entries must be unique.
|
CursorBuilder |
newCursor()
Convenience method for constructing a new CursorBuilder for this Index.
|
boolean |
shouldIgnoreNulls()
Whether or not
null values are actually recorded in the index. |
String |
toString() |
protected static void |
writeDefinitions(com.healthmarketscience.jackcess.impl.TableCreator creator,
ByteBuffer buffer)
Writes the logical index definitions into a table definition buffer.
|
protected static final org.apache.commons.logging.Log LOG
public static final byte PRIMARY_KEY_INDEX_TYPE
public static final byte FOREIGN_KEY_INDEX_TYPE
protected IndexImpl(ByteBuffer tableBuffer, List<IndexData> indexDatas, JetFormat format) throws IOException
IOException
public IndexData getIndexData()
public JetFormat getFormat()
public PageChannel getPageChannel()
public int getIndexNumber()
public byte getIndexFlags()
public int getUniqueEntryCount()
public int getUniqueEntryCountOffset()
public boolean isPrimaryKey()
isPrimaryKey
in interface Index
public boolean isForeignKey()
isForeignKey
in interface Index
public IndexImpl.ForeignKeyReference getReference()
public IndexImpl getReferencedIndex() throws IOException
getReferencedIndex
in interface Index
null
.IOException
public boolean shouldIgnoreNulls()
Index
null
values are actually recorded in the index.shouldIgnoreNulls
in interface Index
public boolean isUnique()
Index
Some notes about uniqueness:
null
entries
invalid for a unique indexpublic List<IndexData.ColumnDescriptor> getColumns()
getColumns
in interface Index
public CursorBuilder newCursor()
Index
public boolean isInitialized()
public void initialize() throws IOException
IOException
public IndexData.EntryCursor cursor() throws IOException
Forces index initialization.
IOException
public IndexData.EntryCursor cursor(Object[] startRow, boolean startInclusive, Object[] endRow, boolean endInclusive) throws IOException
Forces index initialization.
startRow
- the first row of data for the cursor, or null
for
the first entrystartInclusive
- whether or not startRow is inclusive or exclusiveendRow
- the last row of data for the cursor, or null
for
the last entryendInclusive
- whether or not endRow is inclusive or exclusiveIOException
public Object[] constructIndexRowFromEntry(Object... values)
IllegalArgumentException
- if the wrong number of values are
providedpublic Object[] constructIndexRow(String colName, Object value)
null
if not all
columns for this index were providedpublic Object[] constructIndexRow(Map<String,?> row)
null
if not all
columns for this index were providedpublic int compareTo(IndexImpl other)
compareTo
in interface Comparable<IndexImpl>
protected static void writeDefinitions(com.healthmarketscience.jackcess.impl.TableCreator creator, ByteBuffer buffer) throws IOException
creator
- description of the indexes to writebuffer
- Buffer to write toIOException
Copyright © 2005–2018. All rights reserved.