|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.iapi.sql.dictionary.TupleDescriptor
org.apache.derby.iapi.sql.dictionary.TableDescriptor
public class TableDescriptor
This class represents a table descriptor. The external interface to this class is:
| Fields inherited from interface org.apache.derby.catalog.Dependable |
|---|
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 Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
void |
emptyConstraintDescriptorList()
Empty the constraint descriptor list |
void |
emptyTriggerDescriptorList()
Empty the trigger descriptor list |
void |
getAllRelevantConstraints(int statementType,
boolean skipCheckConstraints,
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,
GenericDescriptorList 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 |
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 |
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. |
GenericDescriptorList |
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). |
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(GenericDescriptorList 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 autoincrement 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 |
| Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor |
|---|
getColumnDependableFinder, getDataDictionary, getDependableFinder, setDataDictionary |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
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 GenericDescriptorList triggerDescriptorList
ViewDescriptor viewDescriptor
private java.util.List statisticsDescriptorList
| Constructor Detail |
|---|
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 value
public 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.| Method Detail |
|---|
private FormatableBitSet referencedColumnMapGet()
private void referencedColumnMapPut(FormatableBitSet newReferencedColumnMap)
public java.lang.String getSchemaName()
public SchemaDescriptor getSchemaDescriptor()
getSchemaDescriptor in interface UniqueSQLObjectDescriptorpublic java.lang.String getName()
getName in interface UniqueSQLObjectDescriptorpublic void setTableName(java.lang.String newTableName)
newTableName - The new table name.public java.lang.String getQualifiedName()
public UUID getUUID()
getUUID in interface UniqueTupleDescriptorpublic 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 map
public 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 failure
public 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 DependableisPersistent in class TupleDescriptorpublic boolean isSynonymDescriptor()
public int getTotalNumberOfIndexes()
throws StandardException
StandardExceptiongetQualifiedNumberOfIndexes(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 columns
getTotalNumberOfIndexes()
public void getAllRelevantTriggers(int statementType,
int[] changedColumnIds,
GenericDescriptorList 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 error
public void getAllRelevantConstraints(int statementType,
boolean skipCheckConstraints,
int[] changedColumnIds,
boolean[] needsDeferredProcessing,
ConstraintDescriptorList relevantConstraints)
throws StandardException
statementType - As defined in StatementType.skipCheckConstraints - Skip check constraintschangedColumnIds - 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 DependableDependable.getDependableFinder()public java.lang.String getObjectName()
getObjectName in interface Dependablepublic UUID getObjectID()
getObjectID in interface Dependablepublic java.lang.String getClassType()
getClassType in interface Dependablepublic java.lang.String toString()
toString in class java.lang.Objectpublic 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 descriptor
public void emptyConstraintDescriptorList()
throws StandardException
StandardException - Thrown on failure
public ReferencedKeyConstraintDescriptor getPrimaryKey()
throws StandardException
StandardException - Thrown on failure
public GenericDescriptorList getTriggerDescriptorList()
throws StandardException
StandardException - Thrown on failurepublic void setTriggerDescriptorList(GenericDescriptorList newCDL)
newCDL - The new trigger descriptor list for this table descriptor
public void emptyTriggerDescriptorList()
throws StandardException
StandardException - Thrown on failure
public boolean tableNameEquals(java.lang.String otherTableName,
java.lang.String otherSchemaName)
otherTableName - the other table nameotherSchemaName - the other schema name
public void removeConglomerateDescriptor(ConglomerateDescriptor cd)
throws StandardException
cd - The conglomerate descriptor
StandardException - on error
public void removeConstraintDescriptor(ConstraintDescriptor cd)
throws StandardException
cd - constraint descriptor
StandardException - on errorpublic ColumnDescriptor getColumnDescriptor(java.lang.String columnName)
columnName - A String containing the name of the column
public ColumnDescriptor getColumnDescriptor(int columnNumber)
columnNumber - The ordinal position of the column in the table
public ConglomerateDescriptor[] getConglomerateDescriptors()
StandardException - Thrown on failure
public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber)
throws StandardException
conglomerateNumber - The conglomerate number
we're interested in
StandardException - Thrown on failure
public ConglomerateDescriptor[] getConglomerateDescriptors(long conglomerateNumber)
throws StandardException
conglomerateNumber - The conglomerate number
we're interested in
StandardException - Thrown on failure
public ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID)
throws StandardException
conglomerateUUID - The UUID for the conglomerate
we're interested in
StandardException - Thrown on failure
public ConglomerateDescriptor[] getConglomerateDescriptors(UUID conglomerateUUID)
throws StandardException
conglomerateUUID - The conglomerate UUID
we're interested in
StandardException - Thrown on failure
public IndexLister getIndexLister()
throws StandardException
StandardException - Thrown on failurepublic boolean tableHasAutoincrement()
public java.lang.String[] getColumnNamesArray()
public long[] getAutoincIncrementArray()
public java.util.List getStatistics()
throws StandardException
StandardException
public void markForIndexStatsUpdate(long tableRowCountEstimate)
throws StandardException
tableRowCountEstimate - row count estimate for this table
StandardException - 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.
StandardExceptionpublic java.lang.String getDescriptorName()
getDescriptorName in class TupleDescriptorTupleDescriptor.getDescriptorName()public java.lang.String getDescriptorType()
TupleDescriptor
getDescriptorType in class TupleDescriptorTupleDescriptor.getDescriptorType()public boolean isValid()
isValid in interface Dependent
public void prepareToInvalidate(Provider p,
int action,
LanguageConnectionContext lcc)
throws StandardException
prepareToInvalidate in interface Dependentaction - The action causing the invalidationp - the providerlcc - The LanguageConnectionContext
StandardException - thrown if unable to make it invalid
public void makeInvalid(int action,
LanguageConnectionContext lcc)
throws StandardException
makeInvalid in interface Dependentaction - The action causing the invalidationlcc - The LanguageConnectionContext
StandardException - thrown if called in sanity mode
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||