Class IndexImpl
- java.lang.Object
-
- com.healthmarketscience.jackcess.impl.IndexImpl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexImpl.ForeignKeyReferenceInformation about a foreign key reference defined in an index (when referential integrity should be enforced).-
Nested classes/interfaces inherited from interface com.healthmarketscience.jackcess.Index
Index.Column
-
-
Field Summary
Fields Modifier and Type Field Description static byteFOREIGN_KEY_INDEX_TYPEindex type for foreign key indexesstatic bytePRIMARY_KEY_INDEX_TYPEindex type for primary key indexes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object[]constructIndexRow(String colName, Object value)Constructs an array of values appropriate for this index from the given column value.Object[]constructIndexRow(Map<String,?> row)Constructs an array of values appropriate for this index from the given column values.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.Object[]constructPartialIndexRow(Object filler, String colName, Object value)Constructs an array of values appropriate for this index from the given column value, which must be the first column of the index.Object[]constructPartialIndexRow(Object filler, Map<String,?> row)Constructs an array of values appropriate for this index from the given column values, possibly only using a subset of the given values.Object[]constructPartialIndexRowFromEntry(Object filler, Object... values)Constructs an array of values appropriate for this index from the given column values, possibly only providing a prefix subset of the index columns (at least one value must be provided).IndexData.EntryCursorcursor()Gets a new cursor for this index.IndexData.EntryCursorcursor(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.intgetColumnCount()List<IndexData.ColumnDescriptor>getColumns()JetFormatgetFormat()IndexDatagetIndexData()bytegetIndexFlags()intgetIndexNumber()StringgetName()PageChannelgetPageChannel()PropertyMapgetProperties()Returns the properties for this index.IndexImpl.ForeignKeyReferencegetReference()IndexImplgetReferencedIndex()TableImplgetTable()intgetUniqueEntryCount()intgetUniqueEntryCountOffset()voidinitialize()Forces initialization of this index (actual parsing of index pages).booleanisForeignKey()booleanisInitialized()Whether or not the complete index state has been read.booleanisPrimaryKey()booleanisRequired()Whether or not values are required for index columns.booleanisUnique()Whether or not index entries must be unique.CursorBuildernewCursor()Convenience method for constructing a new CursorBuilder for this Index.booleanshouldIgnoreNulls()Whether or notnullvalues are actually recorded in the index.StringtoString()
-
-
-
Field Detail
-
PRIMARY_KEY_INDEX_TYPE
public static final byte PRIMARY_KEY_INDEX_TYPE
index type for primary key indexes- See Also:
- Constant Field Values
-
FOREIGN_KEY_INDEX_TYPE
public static final byte FOREIGN_KEY_INDEX_TYPE
index type for foreign key indexes- See Also:
- Constant Field Values
-
-
Method Detail
-
getIndexData
public IndexData getIndexData()
-
getFormat
public JetFormat getFormat()
-
getPageChannel
public PageChannel getPageChannel()
-
getIndexNumber
public int getIndexNumber()
-
getIndexFlags
public byte getIndexFlags()
-
getUniqueEntryCount
public int getUniqueEntryCount()
-
getUniqueEntryCountOffset
public int getUniqueEntryCountOffset()
-
getProperties
public PropertyMap getProperties() throws IOException
Description copied from interface:IndexReturns the properties for this index. An index has a property block of its own, separate from the block of the column it is named after.- Specified by:
getPropertiesin interfaceIndex- Throws:
IOException
-
isPrimaryKey
public boolean isPrimaryKey()
- Specified by:
isPrimaryKeyin interfaceIndex
-
isForeignKey
public boolean isForeignKey()
- Specified by:
isForeignKeyin interfaceIndex
-
getReference
public IndexImpl.ForeignKeyReference getReference()
-
getReferencedIndex
public IndexImpl getReferencedIndex() throws IOException
- Specified by:
getReferencedIndexin interfaceIndex- Returns:
- the Index referenced by this Index's ForeignKeyReference (if it
has one), otherwise
null. - Throws:
IOException
-
shouldIgnoreNulls
public boolean shouldIgnoreNulls()
Description copied from interface:IndexWhether or notnullvalues are actually recorded in the index.- Specified by:
shouldIgnoreNullsin interfaceIndex
-
isUnique
public boolean isUnique()
Description copied from interface:IndexWhether or not index entries must be unique.Some notes about uniqueness:
- Access does not seem to consider multiple
nullentries invalid for a unique index - text indexes collapse case, and Access seems to compare only the index entry bytes, therefore two strings which differ only in case will violate the unique constraint
- Access does not seem to consider multiple
-
isRequired
public boolean isRequired()
Description copied from interface:IndexWhether or not values are required for index columns.- Specified by:
isRequiredin interfaceIndex
-
getColumns
public List<IndexData.ColumnDescriptor> getColumns()
- Specified by:
getColumnsin interfaceIndex- Returns:
- the Columns for this index (unmodifiable)
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfaceIndex
-
newCursor
public CursorBuilder newCursor()
Description copied from interface:IndexConvenience method for constructing a new CursorBuilder for this Index.
-
isInitialized
public boolean isInitialized()
Whether or not the complete index state has been read.
-
initialize
public void initialize() throws IOExceptionForces initialization of this index (actual parsing of index pages). normally, the index will not be initialized until the entries are actually needed.- Throws:
IOException
-
cursor
public IndexData.EntryCursor cursor() throws IOException
Gets a new cursor for this index.Forces index initialization.
- Throws:
IOException
-
cursor
public IndexData.EntryCursor cursor(Object[] startRow, boolean startInclusive, Object[] endRow, boolean endInclusive) throws IOException
Gets a new cursor for this index, narrowed to the range defined by the given startRow and endRow.Forces index initialization.
- Parameters:
startRow- the first row of data for the cursor, ornullfor the first entrystartInclusive- whether or not startRow is inclusive or exclusiveendRow- the last row of data for the cursor, ornullfor the last entryendInclusive- whether or not endRow is inclusive or exclusive- Throws:
IOException
-
constructIndexRowFromEntry
public 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.- Returns:
- the appropriate sparse array of data
- Throws:
IllegalArgumentException- if the wrong number of values are provided
-
constructPartialIndexRowFromEntry
public Object[] constructPartialIndexRowFromEntry(Object filler, Object... values)
Constructs an array of values appropriate for this index from the given column values, possibly only providing a prefix subset of the index columns (at least one value must be provided). If a prefix entry is provided, any missing, trailing index entry values will use the given filler value.- Returns:
- the appropriate sparse array of data
- Throws:
IllegalArgumentException- if at least one value is not provided
-
constructIndexRow
public Object[] constructIndexRow(String colName, Object value)
Constructs an array of values appropriate for this index from the given column value.- Returns:
- the appropriate sparse array of data or
nullif not all columns for this index were provided
-
constructPartialIndexRow
public Object[] constructPartialIndexRow(Object filler, String colName, Object value)
Constructs an array of values appropriate for this index from the given column value, which must be the first column of the index. Any missing, trailing index entry values will use the given filler value.- Returns:
- the appropriate sparse array of data or
nullif no prefix list of columns for this index were provided
-
constructIndexRow
public Object[] constructIndexRow(Map<String,?> row)
Constructs an array of values appropriate for this index from the given column values.- Returns:
- the appropriate sparse array of data or
nullif not all columns for this index were provided
-
constructPartialIndexRow
public Object[] constructPartialIndexRow(Object filler, Map<String,?> row)
Constructs an array of values appropriate for this index from the given column values, possibly only using a subset of the given values. A partial row can be created if one or more prefix column values are provided. If a prefix can be found, any missing, trailing index entry values will use the given filler value.- Returns:
- the appropriate sparse array of data or
nullif no prefix list of columns for this index were provided
-
-