Dependable
, Dependent
, Provider
public class TableDescriptor extends UniqueSQLObjectDescriptor implements Provider, Dependent
ACTIVATION, ALIAS, COLUMNS_IN_TABLE, COLUMNS_PERMISSION, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PERM, PREPARED_STATEMENT, ROLE_GRANT, ROUTINE_PERMISSION, SCHEMA, SEQUENCE, STORED_PREPARED_STATEMENT, TABLE, TABLE_PERMISSION, TRIGGER, VIEW
Constructor | Description |
---|---|
TableDescriptor(DataDictionary dataDictionary,
java.lang.String tableName,
SchemaDescriptor schema,
int tableType,
boolean onCommitDeleteRows,
boolean onRollbackDeleteRows) |
Constructor for a TableDescriptor (this is for a temporary table).
|
TableDescriptor(DataDictionary dataDictionary,
java.lang.String tableName,
SchemaDescriptor schema,
int tableType,
char lockGranularity) |
Constructor for a TableDescriptor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
emptyConstraintDescriptorList() |
Empty the constraint descriptor list
|
void |
emptyTriggerDescriptorList() |
Empty the trigger descriptor list
|
void |
getAllRelevantConstraints(int statementType,
int[] changedColumnIds,
boolean[] needsDeferredProcessing,
ConstraintDescriptorList relevantConstraints) |
Gets all of the relevant constraints for a statement, given its
statement type and its list of updated columns.
|
void |
getAllRelevantTriggers(int statementType,
int[] changedColumnIds,
TriggerDescriptorList relevantTriggers) |
Builds a list of all triggers which are relevant to a
given statement type, given a list of updated columns.
|
boolean |
getAndClearIndexStatsIsUpToDate() |
Tells if the index statistics for the indexes associated with this table
are consideres up-to-date, and clears the state.
|
long[] |
getAutoincIncrementArray() |
gets an array of increment values for autoincrement columns in the target
table.
|
java.lang.String |
getClassType() |
Get the provider's type.
|
int[] |
getColumnCollationIds() |
Return an array of collation ids for this table.
|
ColumnDescriptor |
getColumnDescriptor(int columnNumber) |
|
ColumnDescriptor |
getColumnDescriptor(java.lang.String columnName) |
Get the descriptor for a column in the table,
either by the column name or by its ordinal position (column number).
|
ColumnDescriptorList |
getColumnDescriptorList() |
Gets the column descriptor list
|
int[] |
getColumnIDs(java.lang.String[] names) |
Turn an array of column names into the corresponding 1-based column positions.
|
java.lang.String[] |
getColumnNamesArray() |
Gets an array of column names.
|
ConglomerateDescriptor |
getConglomerateDescriptor(long conglomerateNumber) |
Gets a conglomerate descriptor for the given table and conglomerate number.
|
ConglomerateDescriptor |
getConglomerateDescriptor(UUID conglomerateUUID) |
Gets a conglomerate descriptor for the given table and conglomerate UUID String.
|
ConglomerateDescriptorList |
getConglomerateDescriptorList() |
Gets the conglomerate descriptor list
|
ConglomerateDescriptor[] |
getConglomerateDescriptors() |
Gets a ConglomerateDescriptor[] to loop through all the conglomerate descriptors
for the table.
|
ConglomerateDescriptor[] |
getConglomerateDescriptors(long conglomerateNumber) |
Gets array of conglomerate descriptors for the given table and
conglomerate number.
|
ConglomerateDescriptor[] |
getConglomerateDescriptors(UUID conglomerateUUID) |
Gets array of conglomerate descriptors for the given table and
conglomerate UUID.
|
ConstraintDescriptorList |
getConstraintDescriptorList() |
Gets the constraint descriptor list
|
private static Context |
getContextOrNull(java.lang.String contextID) |
Privileged lookup of a Context.
|
DependableFinder |
getDependableFinder() |
Get an object which can be written to disk and which,
when read from disk, will find or reconstruct this in-memory
Dependable.
|
java.lang.String |
getDescriptorName() |
|
java.lang.String |
getDescriptorType() |
Each descriptor must identify itself with its type; i.e index, check
constraint whatever.
|
ExecRow |
getEmptyExecRow() |
Gets an ExecRow for rows stored in the table this describes.
|
ColumnDescriptorList |
getGeneratedColumns() |
Gets the list of columns defined by generation clauses.
|
long |
getHeapConglomerateId() |
Gets the id for the heap conglomerate of the table.
|
IndexLister |
getIndexLister() |
Gets an object which lists out all the index row generators on a table together
with their conglomerate ids.
|
java.lang.String |
getIndexStatsUpdateReason() |
Returns the update criteria telling why the statistics are considered
stale.
|
char |
getLockGranularity() |
Gets the lock granularity for the table.
|
int |
getMaxColumnID() |
Gets the highest column id in the table.
|
java.lang.String |
getName() |
Gets the name of the table.
|
int |
getNumberOfColumns() |
Gets the number of columns in the table.
|
UUID |
getObjectID() |
Get the provider's UUID
|
java.lang.String |
getObjectName() |
Return the name of this Provider.
|
ReferencedKeyConstraintDescriptor |
getPrimaryKey() |
Gets the primary key, may return null if no primary key
|
java.lang.String |
getQualifiedName() |
Gets the full, qualified name of the table.
|
int |
getQualifiedNumberOfIndexes(int minColCount,
boolean nonUniqeTrumpsColCount) |
Returns the number of indexes matching the criteria.
|
FormatableBitSet |
getReferencedColumnMap() |
Get the referenced column map of the table.
|
SchemaDescriptor |
getSchemaDescriptor() |
Gets the SchemaDescriptor for this TableDescriptor.
|
java.lang.String |
getSchemaName() |
Gets the name of the schema the table lives in.
|
java.util.List<StatisticsDescriptor> |
getStatistics() |
Returns a list of statistics for this table.
|
int |
getTableType() |
Gets an identifier telling what type of table this is
(base table, declared global temporary table, view, etc.)
|
int |
getTotalNumberOfIndexes() |
Gets the number of indexes on the table, including the backing indexes.
|
TriggerDescriptorList |
getTriggerDescriptorList() |
Gets the trigger descriptor list
|
UUID |
getUUID() |
Gets the UUID of the table.
|
ViewDescriptor |
getViewDescriptor() |
Gets the view descriptor for this TableDescriptor.
|
boolean |
isOnCommitDeleteRows() |
Gets the on commit behavior for the declared global temporary table.
|
boolean |
isOnRollbackDeleteRows() |
Gets the on rollback behavior for the declared global temporary table.
|
boolean |
isPersistent() |
Is this provider persistent?
|
boolean |
isSynonymDescriptor() |
Is this descriptor represents a synonym?
|
boolean |
isValid() |
Check that all of the dependent's dependencies are valid.
|
FormatableBitSet |
makeColumnMap(ColumnDescriptorList cdl) |
Given a list of columns in the table, construct a bit map of those
columns' ids.
|
void |
makeInvalid(int action,
LanguageConnectionContext lcc) |
Mark the dependent as invalid (due to at least one of
its dependencies being invalid).
|
static java.lang.String |
makeSequenceName(UUID tableID) |
Make the name of an identity sequence generator from a table ID
|
void |
markForIndexStatsUpdate(long tableRowCountEstimate) |
Marks the cardinality statistics for the indexes associated with this
table for update if they are considered stale, or for creation if they
don't exist, and if it is considered useful to update/create them.
|
void |
prepareToInvalidate(Provider p,
int action,
LanguageConnectionContext lcc) |
Prepare to mark the dependent as invalid (due to at least one of
its dependencies being invalid).
|
private FormatableBitSet |
referencedColumnMapGet() |
|
private void |
referencedColumnMapPut(FormatableBitSet newReferencedColumnMap) |
|
void |
removeConglomerateDescriptor(ConglomerateDescriptor cd) |
Remove this descriptor
|
void |
removeConstraintDescriptor(ConstraintDescriptor cd) |
Remove this descriptor.
|
void |
resetHeapConglomNumber() |
Sets the heapConglomNumber to -1 for temporary table since the table was dropped and recreated at the commit time
and hence its conglomerate id has changed.
|
double |
selectivityForConglomerate(ConglomerateDescriptor cd,
int numKeys) |
For this conglomerate (index), return the selectivity of the first
numKeys.
|
void |
setConstraintDescriptorList(ConstraintDescriptorList newCDL) |
Sets the constraint descriptor list
|
void |
setLockGranularity(char lockGranularity) |
Sets the lock granularity for the table to the specified value.
|
void |
setReferencedColumnMap(FormatableBitSet referencedColumnMap) |
Set the referenced column map of the table.
|
void |
setTableName(java.lang.String newTableName) |
Sets the the table name in case of rename table.
|
void |
setTriggerDescriptorList(TriggerDescriptorList newCDL) |
Sets the trigger descriptor list
|
void |
setUUID(UUID oid) |
Sets the UUID of the table
|
void |
setViewDescriptor(ViewDescriptor viewDescriptor) |
Set (cache) the view descriptor for this TableDescriptor
|
boolean |
statisticsExist(ConglomerateDescriptor cd) |
Are there statistics for this particular conglomerate.
|
boolean |
tableHasAutoincrement() |
Does the table have an auto-increment column or not?
|
boolean |
tableNameEquals(java.lang.String otherTableName,
java.lang.String otherSchemaName) |
Compare the tables descriptors based on the names.
|
java.lang.String |
toString() |
Prints the contents of the TableDescriptor
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getColumnDependableFinder, getDataDictionary, getDependableFinder, setDataDictionary
public static final int BASE_TABLE_TYPE
public static final int SYSTEM_TABLE_TYPE
public static final int VIEW_TYPE
public static final int GLOBAL_TEMPORARY_TABLE_TYPE
public static final int SYNONYM_TYPE
public static final int VTI_TYPE
public static final char ROW_LOCK_GRANULARITY
public static final char TABLE_LOCK_GRANULARITY
public static final char DEFAULT_LOCK_GRANULARITY
public static final int ISTATS_CREATE_THRESHOLD
public static final int ISTATS_ABSDIFF_THRESHOLD
public static final double ISTATS_LNDIFF_THRESHOLD
private char lockGranularity
private boolean onCommitDeleteRows
private boolean onRollbackDeleteRows
private boolean indexStatsUpToDate
private java.lang.String indexStatsUpdateReason
SchemaDescriptor schema
java.lang.String tableName
UUID oid
int tableType
private volatile long heapConglomNumber
The id of the heap conglomerate for the table described by this
instance. The value -1 means it's uninitialized, in which case it
will be initialized lazily when getHeapConglomerateId()
is
called.
It is declared volatile to ensure that concurrent callers of
getHeapConglomerateId()
while heapConglomNumber
is
uninitialized, will either see the value -1 or the fully initialized
conglomerate number, and never see a partially initialized value
(as was the case in DERBY-5358 because reads/writes of a long field are
not guaranteed to be atomic unless the field is declared volatile).
ColumnDescriptorList columnDescriptorList
ConglomerateDescriptorList conglomerateDescriptorList
ConstraintDescriptorList constraintDescriptorList
private TriggerDescriptorList triggerDescriptorList
ViewDescriptor viewDescriptor
private java.util.List<StatisticsDescriptor> statisticsDescriptorList
public TableDescriptor(DataDictionary dataDictionary, java.lang.String tableName, SchemaDescriptor schema, int tableType, boolean onCommitDeleteRows, boolean onRollbackDeleteRows)
dataDictionary
- The data dictionary that this descriptor lives intableName
- The name of the temporary tableschema
- The schema descriptor for this table.tableType
- An integer identifier for the type of the table : declared global temporary tableonCommitDeleteRows
- If true, on commit delete rows else on commit preserve rows of temporary table.onRollbackDeleteRows
- If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported valuepublic TableDescriptor(DataDictionary dataDictionary, java.lang.String tableName, SchemaDescriptor schema, int tableType, char lockGranularity)
dataDictionary
- The data dictionary that this descriptor lives intableName
- The name of the tableschema
- The schema descriptor for this table.tableType
- An integer identifier for the type of the table
(base table, view, etc.)lockGranularity
- The lock granularity.private FormatableBitSet referencedColumnMapGet()
private void referencedColumnMapPut(FormatableBitSet newReferencedColumnMap)
public java.lang.String getSchemaName()
public SchemaDescriptor getSchemaDescriptor()
getSchemaDescriptor
in class UniqueSQLObjectDescriptor
public java.lang.String getName()
getName
in class UniqueSQLObjectDescriptor
public void setTableName(java.lang.String newTableName)
newTableName
- The new table name.public java.lang.String getQualifiedName()
public UUID getUUID()
getUUID
in class UniqueTupleDescriptor
public int getTableType()
public long getHeapConglomerateId() throws StandardException
StandardException
- Thrown on errorpublic int getNumberOfColumns()
public FormatableBitSet getReferencedColumnMap()
public void setReferencedColumnMap(FormatableBitSet referencedColumnMap)
referencedColumnMap
- FormatableBitSet of referenced columns.public FormatableBitSet makeColumnMap(ColumnDescriptorList cdl)
cdl
- list of columns whose positions we want to record in the bit mappublic int getMaxColumnID() throws StandardException
StandardException
- Thrown on errorpublic void setUUID(UUID oid)
oid
- The UUID of the table to be set in the descriptorpublic char getLockGranularity()
public void setLockGranularity(char lockGranularity)
lockGranularity
- The new lockGranularity.public boolean isOnRollbackDeleteRows()
public boolean isOnCommitDeleteRows()
public void resetHeapConglomNumber()
public ExecRow getEmptyExecRow() throws StandardException
StandardException
- Thrown on failurepublic int[] getColumnCollationIds() 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(). This is only expected to get called during ddl, so object allocation is ok.
StandardException
- Standard exception policy.public ConglomerateDescriptorList getConglomerateDescriptorList()
public ViewDescriptor getViewDescriptor()
public void setViewDescriptor(ViewDescriptor viewDescriptor)
viewDescriptor
- The view descriptor to cache.public boolean isPersistent()
isPersistent
in interface Dependable
isPersistent
in class TupleDescriptor
public boolean isSynonymDescriptor()
public int getTotalNumberOfIndexes() throws StandardException
StandardException
getQualifiedNumberOfIndexes(int, boolean)
public int getQualifiedNumberOfIndexes(int minColCount, boolean nonUniqeTrumpsColCount)
minColCount
- the minimum number of ordered columns in the indexes
we want to countnonUniqeTrumpsColCount
- if true
a non-unique index will be
included in the count even if it has less than minColCount
ordered columnsgetTotalNumberOfIndexes()
public void getAllRelevantTriggers(int statementType, int[] changedColumnIds, TriggerDescriptorList relevantTriggers) throws StandardException
statementType
- defined in StatementTypechangedColumnIds
- array of changed columnsrelevantTriggers
- IN/OUT. Passed in as an empty list. Filled in as we go.StandardException
- Thrown on errorpublic void getAllRelevantConstraints(int statementType, int[] changedColumnIds, boolean[] needsDeferredProcessing, ConstraintDescriptorList relevantConstraints) throws StandardException
statementType
- As defined in StatementType.changedColumnIds
- If null, all columns being changed, otherwise array
of 1-based column ids for columns being changedneedsDeferredProcessing
- IN/OUT. true if the statement already needs
deferred processing. set while evaluating this
routine if a trigger or constraint requires
deferred processingrelevantConstraints
- IN/OUT. Empty list is passed in. We hang constraints on it as we go.StandardException
- Thrown on errorpublic DependableFinder getDependableFinder()
Dependable
getDependableFinder
in interface Dependable
Dependable.getDependableFinder()
public java.lang.String getObjectName()
getObjectName
in interface Dependable
public UUID getObjectID()
getObjectID
in interface Dependable
public java.lang.String getClassType()
getClassType
in interface Dependable
public java.lang.String toString()
toString
in class java.lang.Object
public ColumnDescriptorList getColumnDescriptorList()
public ColumnDescriptorList getGeneratedColumns()
public int[] getColumnIDs(java.lang.String[] names)
public ConstraintDescriptorList getConstraintDescriptorList() throws StandardException
StandardException
- Thrown on failurepublic void setConstraintDescriptorList(ConstraintDescriptorList newCDL)
newCDL
- The new constraint descriptor list for this table descriptorpublic void emptyConstraintDescriptorList() throws StandardException
StandardException
- Thrown on failurepublic ReferencedKeyConstraintDescriptor getPrimaryKey() throws StandardException
StandardException
- Thrown on failurepublic TriggerDescriptorList getTriggerDescriptorList() throws StandardException
StandardException
- Thrown on failurepublic void setTriggerDescriptorList(TriggerDescriptorList newCDL)
newCDL
- The new trigger descriptor list for this table descriptorpublic void emptyTriggerDescriptorList() throws StandardException
StandardException
- Thrown on failurepublic boolean tableNameEquals(java.lang.String otherTableName, java.lang.String otherSchemaName)
otherTableName
- the other table nameotherSchemaName
- the other schema namepublic void removeConglomerateDescriptor(ConglomerateDescriptor cd) throws StandardException
cd
- The conglomerate descriptorStandardException
- on errorpublic void removeConstraintDescriptor(ConstraintDescriptor cd) throws StandardException
cd
- constraint descriptorStandardException
- on errorpublic ColumnDescriptor getColumnDescriptor(java.lang.String columnName)
columnName
- A String containing the name of the columnpublic ColumnDescriptor getColumnDescriptor(int columnNumber)
columnNumber
- The ordinal (1-based) position of the column in the tablepublic ConglomerateDescriptor[] getConglomerateDescriptors()
public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber) throws StandardException
conglomerateNumber
- The conglomerate number
we're interested inStandardException
- Thrown on failurepublic ConglomerateDescriptor[] getConglomerateDescriptors(long conglomerateNumber) throws StandardException
conglomerateNumber
- The conglomerate number
we're interested inStandardException
- Thrown on failurepublic ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID) throws StandardException
conglomerateUUID
- The UUID for the conglomerate
we're interested inStandardException
- Thrown on failurepublic ConglomerateDescriptor[] getConglomerateDescriptors(UUID conglomerateUUID) throws StandardException
conglomerateUUID
- The conglomerate UUID
we're interested inStandardException
- Thrown on failurepublic IndexLister getIndexLister() throws StandardException
StandardException
- Thrown on failurepublic boolean tableHasAutoincrement()
public java.lang.String[] getColumnNamesArray()
public long[] getAutoincIncrementArray()
public java.util.List<StatisticsDescriptor> getStatistics() throws StandardException
StandardException
public void markForIndexStatsUpdate(long tableRowCountEstimate) throws StandardException
tableRowCountEstimate
- row count estimate for this tableStandardException
- if obtaining index statistics failspublic boolean getAndClearIndexStatsIsUpToDate()
true
if the statistics are considered up-to-date,
false
if not.public java.lang.String getIndexStatsUpdateReason()
This method is used for debugging.
public boolean statisticsExist(ConglomerateDescriptor cd) throws StandardException
cd
- Conglomerate/Index for which we want to check if statistics
exist. cd can be null in which case user wants to know if there are any
statistics at all on the table.StandardException
public double selectivityForConglomerate(ConglomerateDescriptor cd, int numKeys) throws StandardException
cd
- ConglomerateDescriptor (Index) whose
cardinality we are interested in.numKeys
- Number of leading columns of the index for which
cardinality is desired.StandardException
public java.lang.String getDescriptorName()
getDescriptorName
in class TupleDescriptor
TupleDescriptor.getDescriptorName()
public java.lang.String getDescriptorType()
TupleDescriptor
getDescriptorType
in class TupleDescriptor
TupleDescriptor.getDescriptorType()
public boolean isValid()
public void prepareToInvalidate(Provider p, int action, LanguageConnectionContext lcc) throws StandardException
prepareToInvalidate
in interface Dependent
action
- The action causing the invalidationp
- the providerlcc
- The LanguageConnectionContextStandardException
- thrown if unable to make it invalidpublic void makeInvalid(int action, LanguageConnectionContext lcc) throws StandardException
makeInvalid
in interface Dependent
action
- The action causing the invalidationlcc
- The LanguageConnectionContextStandardException
- thrown if called in sanity modepublic static java.lang.String makeSequenceName(UUID tableID)
private static Context getContextOrNull(java.lang.String contextID)
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.