public class IndexRowGenerator extends java.lang.Object implements IndexDescriptor, Formatable
For a description of how deferrable and non-deferrable constraints
are backed differently, including the meaning of the
boolean attributes used here, see IndexDescriptor
.
Modifier and Type | Field and Description |
---|---|
private ExecutionFactory |
ef |
private IndexDescriptor |
id |
Constructor and Description |
---|
IndexRowGenerator()
Zero-argument constructor for Formatable interface
|
IndexRowGenerator(IndexDescriptor indexDescriptor)
Constructor for an IndexRowGeneratorImpl
|
IndexRowGenerator(java.lang.String indexType,
boolean isUnique,
boolean isUniqueWithDuplicateNulls,
boolean isUniqueDeferrable,
boolean hasDeferrableChecking,
int[] baseColumnPositions,
boolean[] isAscending,
int numberOfOrderedColumns)
Constructor for an IndexRowGeneratorImpl
|
Modifier and Type | Method and Description |
---|---|
int[] |
baseColumnPositions()
Returns an array of column positions in the base table.
|
boolean |
equals(java.lang.Object other)
Test for value equality
|
int[] |
getColumnCollationIds(ColumnDescriptorList columnList)
Return an array of collation ids for this table.
|
private static Context |
getContext(java.lang.String contextID)
Privileged lookup of a Context.
|
private ExecutionFactory |
getExecutionFactory() |
IndexDescriptor |
getIndexDescriptor()
Get the IndexDescriptor that this IndexRowGenerator is based on.
|
void |
getIndexRow(ExecRow baseRow,
RowLocation rowLocation,
ExecIndexRow indexRow,
FormatableBitSet bitSet)
Get an index row for this index given a row from the base table
and the RowLocation of the base row.
|
ExecIndexRow |
getIndexRowTemplate()
Get a template for the index row, to be used with getIndexRow.
|
int |
getKeyColumnPosition(int heapColumnPosition)
Returns the postion of a column.
|
ExecIndexRow |
getNullIndexRow(ColumnDescriptorList columnList,
RowLocation rowLocation)
Get a NULL Index Row for this index.
|
int |
getTypeFormatId()
Get a universally unique identifier for the type of
this object.
|
boolean |
hasDeferrableChecking()
Returns true if the index is used to support a deferrable constraint.
|
int |
hashCode() |
java.lang.String |
indexType()
Returns the type of the index.
|
boolean[] |
isAscending()
Returns array of boolean telling asc/desc info for each index
key column for convenience of using together with baseColumnPositions
method.
|
boolean |
isAscending(java.lang.Integer keyColumnPosition)
Returns true if the specified column is ascending in the index
(1-based).
|
boolean |
isDescending(java.lang.Integer keyColumnPosition)
Returns true if the specified column is descending in the index
(1-based).
|
boolean |
isUnique()
Returns true if the index is unique.
|
boolean |
isUniqueDeferrable()
The index represents a PRIMARY KEY or a UNIQUE NOT NULL constraint which
is deferrable.
|
boolean |
isUniqueWithDuplicateNulls()
Returns true if the index is duplicate keys only for null key parts.
|
int |
numberOfOrderedColumns()
Returns the number of ordered columns.
|
void |
readExternal(java.io.ObjectInput in) |
void |
setBaseColumnPositions(int[] baseColumnPositions)
set the baseColumnPositions field of the index descriptor.
|
void |
setIsAscending(boolean[] isAscending)
set the isAscending field of the index descriptor.
|
void |
setNumberOfOrderedColumns(int numberOfOrderedColumns)
set the numberOfOrderedColumns field of the index descriptor.
|
java.lang.String |
toString() |
void |
writeExternal(java.io.ObjectOutput out) |
private IndexDescriptor id
private ExecutionFactory ef
public IndexRowGenerator(java.lang.String indexType, boolean isUnique, boolean isUniqueWithDuplicateNulls, boolean isUniqueDeferrable, boolean hasDeferrableChecking, int[] baseColumnPositions, boolean[] isAscending, int numberOfOrderedColumns)
indexType
- The type of indexisUnique
- True means the index is uniqueisUniqueWithDuplicateNulls
- means the index is almost unique
i.e. unique only for non null keysisUniqueDeferrable
- True means the index represents a PRIMARY
KEY or a UNIQUE NOT NULL constraint which
is deferrable.hasDeferrableChecking
- True if the index is used to back a
deferrable constraintbaseColumnPositions
- An array of column positions in the base
table. Each index column corresponds to a
column position in the base table.isAscending
- An array of booleans telling asc/desc on each
column.numberOfOrderedColumns
- In the future, it will be possible
to store non-ordered columns in an
index. These will be useful for
covered queries.public IndexRowGenerator(IndexDescriptor indexDescriptor)
indexDescriptor
- An IndexDescriptor to delegate calls topublic IndexRowGenerator()
public ExecIndexRow getIndexRowTemplate()
public ExecIndexRow getNullIndexRow(ColumnDescriptorList columnList, RowLocation rowLocation) throws StandardException
columnList
- ColumnDescriptors describing the base table.rowLocation
- empty row location.StandardException
- thrown on error.public void getIndexRow(ExecRow baseRow, RowLocation rowLocation, ExecIndexRow indexRow, FormatableBitSet bitSet) throws StandardException
baseRow
- A row in the base tablerowLocation
- The RowLocation of the row in the base tableindexRow
- A template for the index row. It must have the
correct number of columns.bitSet
- If non-null, then baseRow is a partial row and the
set bits in bitSet represents the column mapping for
the partial row to the complete base row. WARNING:
ONE based!!!StandardException
- Thrown on errorpublic int[] getColumnCollationIds(ColumnDescriptorList columnList) throws StandardException
Return an array of collation ids, one for each column in the columnDescriptorList. This is useful for passing collation id info down to store, for instance in createConglomerate() to create the index. This is only expected to get called during ddl, so object allocation is ok.
columnList
- ColumnDescriptors describing the base table.StandardException
- Standard exception policy.public IndexDescriptor getIndexDescriptor()
public boolean isUniqueWithDuplicateNulls()
IndexDescriptor
isUniqueWithDuplicateNulls
in interface IndexDescriptor
IndexDescriptor.isUniqueWithDuplicateNulls()
public boolean hasDeferrableChecking()
IndexDescriptor
hasDeferrableChecking
in interface IndexDescriptor
public boolean isUniqueDeferrable()
IndexDescriptor
true
implies isUnique() == false
and
isUniqueWithDuplicateNulls() == false
and
hasDeferrableChecking() == true
.isUniqueDeferrable
in interface IndexDescriptor
true
if the index represents such a constraintpublic boolean isUnique()
IndexDescriptor
isUnique
in interface IndexDescriptor
IndexDescriptor.isUnique()
public int[] baseColumnPositions()
IndexDescriptor
baseColumnPositions
in interface IndexDescriptor
IndexDescriptor.baseColumnPositions()
public int getKeyColumnPosition(int heapColumnPosition)
IndexDescriptor
Returns the position of a column within the key (1-based). 0 means that the column is not in the key. Same as the above method, but it uses int instead of Integer.
getKeyColumnPosition
in interface IndexDescriptor
IndexDescriptor.getKeyColumnPosition(int)
public int numberOfOrderedColumns()
IndexDescriptor
In the future, it will be possible to store non-ordered columns in an index. These will be useful for covered queries. The ordered columns will be at the beginning of the index row, and they will be followed by the non-ordered columns. For now, all columns in an index must be ordered.
numberOfOrderedColumns
in interface IndexDescriptor
IndexDescriptor.numberOfOrderedColumns()
public java.lang.String indexType()
IndexDescriptor
indexType
in interface IndexDescriptor
IndexDescriptor.indexType()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isAscending(java.lang.Integer keyColumnPosition)
IndexDescriptor
isAscending
in interface IndexDescriptor
IndexDescriptor.isAscending()
public boolean isDescending(java.lang.Integer keyColumnPosition)
IndexDescriptor
isDescending
in interface IndexDescriptor
IndexDescriptor.isDescending(java.lang.Integer)
public boolean[] isAscending()
IndexDescriptor
isAscending
in interface IndexDescriptor
IndexDescriptor.isAscending()
public void setBaseColumnPositions(int[] baseColumnPositions)
IndexDescriptor
setBaseColumnPositions
in interface IndexDescriptor
IndexDescriptor.setBaseColumnPositions(int[])
public void setIsAscending(boolean[] isAscending)
IndexDescriptor
setIsAscending
in interface IndexDescriptor
IndexDescriptor.setIsAscending(boolean[])
public void setNumberOfOrderedColumns(int numberOfOrderedColumns)
IndexDescriptor
setNumberOfOrderedColumns
in interface IndexDescriptor
IndexDescriptor.setNumberOfOrderedColumns(int)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- The other indexrowgenerator to compare this one withpublic int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
private ExecutionFactory getExecutionFactory()
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
- Thrown on read errorjava.lang.ClassNotFoundException
- Thrown on read errorExternalizable.readExternal(java.io.ObjectInput)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
- Thrown on write errorpublic int getTypeFormatId()
TypedFormat
getTypeFormatId
in interface TypedFormat
private static Context getContext(java.lang.String contextID)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.