Class TableDescriptor
- java.lang.Object
-
- org.apache.derby.iapi.sql.dictionary.TupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.UniqueSQLObjectDescriptor
-
- org.apache.derby.iapi.sql.dictionary.TableDescriptor
-
- All Implemented Interfaces:
Dependable
,Dependent
,Provider
public class TableDescriptor extends UniqueSQLObjectDescriptor implements Provider, Dependent
This class represents a table descriptor. The external interface to this class is:- external interface
- public String getSchemaName();
- public String getQualifiedName();
- public int getTableType();
- public long getHeapConglomerateId() throws StandardException;
- public int getNumberOfColumns();
- public FormatableBitSet getReferencedColumnMap();
- public void setReferencedColumnMap(FormatableBitSet referencedColumnMap);
- public int getMaxColumnID() throws StandardException;
- public void setUUID(UUID uuid);
- public char getLockGranularity();
- public void setTableName(String newTableName);
- public void setLockGranularity(char lockGranularity);
- public ExecRow getEmptyExecRow( ContextManager cm) throws StandardException;
- public boolean tableNameEquals(String otherSchemaName, String otherTableName);
- public ReferencedKeyConstraintDescriptor getPrimaryKey() throws StandardException;
- public void removeConglomerateDescriptor(ConglomerateDescriptor cd) throws StandardException;
- public void removeConstraintDescriptor(ConstraintDescriptor cd) throws StandardException;
- public void getAffectedIndexes(...) throws StandardException;
- public void getAllRelevantTriggers(...) throws StandardException;
- public void getAllRelevantConstraints(...) throws StandardException
- public ColumnDescriptorList getColumnDescriptorList();
- public String[] getColumnNamesArray();
- public long[] getAutoincIncrementArray();
- public ColumnDescriptor getColumnDescriptor(String columnName);
- public ColumnDescriptor getColumnDescriptor(int columnNumber);
- public ConglomerateDescriptor[] getConglomerateDescriptors() throws StandardException;
- public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber) throws StandardException;
- public ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID) throws StandardException;
- public IndexLister getIndexLister() throws StandardException;
- public ViewDescriptor getViewDescriptor();
- public boolean tableHasAutoincrement();
- public boolean statisticsExist(ConglomerateDescriptor cd) throws StandardException;
- public double selectivityForConglomerate(...)throws StandardException;
-
-
Field Summary
-
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
Constructors 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
emptyConstraintDescriptorList()
Empty the constraint descriptor listvoid
emptyTriggerDescriptorList()
Empty the trigger descriptor listvoid
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 listint[]
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 listConglomerateDescriptor[]
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 listprivate 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 UUIDjava.lang.String
getObjectName()
Return the name of this Provider.ReferencedKeyConstraintDescriptor
getPrimaryKey()
Gets the primary key, may return null if no primary keyjava.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 listUUID
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 IDvoid
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 descriptorvoid
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 listvoid
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 listvoid
setUUID(UUID oid)
Sets the UUID of the tablevoid
setViewDescriptor(ViewDescriptor viewDescriptor)
Set (cache) the view descriptor for this TableDescriptorboolean
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-
Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, setDataDictionary
-
-
-
-
Field Detail
-
BASE_TABLE_TYPE
public static final int BASE_TABLE_TYPE
- See Also:
- Constant Field Values
-
SYSTEM_TABLE_TYPE
public static final int SYSTEM_TABLE_TYPE
- See Also:
- Constant Field Values
-
VIEW_TYPE
public static final int VIEW_TYPE
- See Also:
- Constant Field Values
-
GLOBAL_TEMPORARY_TABLE_TYPE
public static final int GLOBAL_TEMPORARY_TABLE_TYPE
- See Also:
- Constant Field Values
-
SYNONYM_TYPE
public static final int SYNONYM_TYPE
- See Also:
- Constant Field Values
-
VTI_TYPE
public static final int VTI_TYPE
- See Also:
- Constant Field Values
-
ROW_LOCK_GRANULARITY
public static final char ROW_LOCK_GRANULARITY
- See Also:
- Constant Field Values
-
TABLE_LOCK_GRANULARITY
public static final char TABLE_LOCK_GRANULARITY
- See Also:
- Constant Field Values
-
DEFAULT_LOCK_GRANULARITY
public static final char DEFAULT_LOCK_GRANULARITY
- See Also:
- Constant Field Values
-
ISTATS_CREATE_THRESHOLD
public static final int ISTATS_CREATE_THRESHOLD
-
ISTATS_ABSDIFF_THRESHOLD
public static final int ISTATS_ABSDIFF_THRESHOLD
-
ISTATS_LNDIFF_THRESHOLD
public static final double ISTATS_LNDIFF_THRESHOLD
-
lockGranularity
private char lockGranularity
-
onCommitDeleteRows
private boolean onCommitDeleteRows
-
onRollbackDeleteRows
private boolean onRollbackDeleteRows
-
indexStatsUpToDate
private boolean indexStatsUpToDate
-
indexStatsUpdateReason
private java.lang.String indexStatsUpdateReason
-
schema
SchemaDescriptor schema
-
tableName
java.lang.String tableName
-
oid
UUID oid
-
tableType
int tableType
-
heapConglomNumber
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()
whileheapConglomNumber
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 columnDescriptorList
-
conglomerateDescriptorList
ConglomerateDescriptorList conglomerateDescriptorList
-
constraintDescriptorList
ConstraintDescriptorList constraintDescriptorList
-
triggerDescriptorList
private TriggerDescriptorList triggerDescriptorList
-
viewDescriptor
ViewDescriptor viewDescriptor
-
statisticsDescriptorList
private java.util.List<StatisticsDescriptor> statisticsDescriptorList
A list of statistics pertaining to this table--
-
-
Constructor Detail
-
TableDescriptor
public 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).- Parameters:
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
-
TableDescriptor
public TableDescriptor(DataDictionary dataDictionary, java.lang.String tableName, SchemaDescriptor schema, int tableType, char lockGranularity)
Constructor for a TableDescriptor.- Parameters:
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
-
referencedColumnMapGet
private FormatableBitSet referencedColumnMapGet()
-
referencedColumnMapPut
private void referencedColumnMapPut(FormatableBitSet newReferencedColumnMap)
-
getSchemaName
public java.lang.String getSchemaName()
Gets the name of the schema the table lives in.- Returns:
- A String containing the name of the schema the table lives in.
-
getSchemaDescriptor
public SchemaDescriptor getSchemaDescriptor()
Gets the SchemaDescriptor for this TableDescriptor.- Specified by:
getSchemaDescriptor
in classUniqueSQLObjectDescriptor
- Returns:
- SchemaDescriptor The SchemaDescriptor.
-
getName
public java.lang.String getName()
Gets the name of the table.- Specified by:
getName
in classUniqueSQLObjectDescriptor
- Returns:
- A String containing the name of the table.
-
setTableName
public void setTableName(java.lang.String newTableName)
Sets the the table name in case of rename table. This is used only by rename table- Parameters:
newTableName
- The new table name.
-
getQualifiedName
public java.lang.String getQualifiedName()
Gets the full, qualified name of the table.- Returns:
- A String containing the name of the table.
-
getUUID
public UUID getUUID()
Gets the UUID of the table.- Specified by:
getUUID
in classUniqueTupleDescriptor
- Returns:
- The UUID of the table.
-
getTableType
public int getTableType()
Gets an identifier telling what type of table this is (base table, declared global temporary table, view, etc.)- Returns:
- An identifier telling what type of table this is.
-
getHeapConglomerateId
public long getHeapConglomerateId() throws StandardException
Gets the id for the heap conglomerate of the table. There may also be keyed conglomerates, these are stored separately in the conglomerates table.- Returns:
- the id of the heap conglomerate for the table.
- Throws:
StandardException
- Thrown on error
-
getNumberOfColumns
public int getNumberOfColumns()
Gets the number of columns in the table.- Returns:
- the number of columns in the table.
-
getReferencedColumnMap
public FormatableBitSet getReferencedColumnMap()
Get the referenced column map of the table.- Returns:
- the referencedColumnMap of the table.
-
setReferencedColumnMap
public void setReferencedColumnMap(FormatableBitSet referencedColumnMap)
Set the referenced column map of the table.- Parameters:
referencedColumnMap
- FormatableBitSet of referenced columns.
-
makeColumnMap
public FormatableBitSet makeColumnMap(ColumnDescriptorList cdl)
Given a list of columns in the table, construct a bit map of those columns' ids.- Parameters:
cdl
- list of columns whose positions we want to record in the bit map
-
getMaxColumnID
public int getMaxColumnID() throws StandardException
Gets the highest column id in the table. For now this is the same as the number of columns. However, in the future, after we implement ALTER TABLE DROP COLUMN, this correspondence won't hold any longer.- Returns:
- the highest column ID in the table
- Throws:
StandardException
- Thrown on error
-
setUUID
public void setUUID(UUID oid)
Sets the UUID of the table- Parameters:
oid
- The UUID of the table to be set in the descriptor
-
getLockGranularity
public char getLockGranularity()
Gets the lock granularity for the table.- Returns:
- A char representing the lock granularity for the table.
-
setLockGranularity
public void setLockGranularity(char lockGranularity)
Sets the lock granularity for the table to the specified value.- Parameters:
lockGranularity
- The new lockGranularity.
-
isOnRollbackDeleteRows
public boolean isOnRollbackDeleteRows()
Gets the on rollback behavior for the declared global temporary table.- Returns:
- A boolean representing the on rollback behavior for the declared global temporary table.
-
isOnCommitDeleteRows
public boolean isOnCommitDeleteRows()
Gets the on commit behavior for the declared global temporary table.- Returns:
- A boolean representing the on commit behavior for the declared global temporary table.
-
resetHeapConglomNumber
public 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. This is used for temporary table descriptors only
-
getEmptyExecRow
public ExecRow getEmptyExecRow() throws StandardException
Gets an ExecRow for rows stored in the table this describes.- Returns:
- the row.
- Throws:
StandardException
- Thrown on failure
-
getColumnCollationIds
public int[] getColumnCollationIds() throws StandardException
Return an array of collation ids for this table.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.
- Throws:
StandardException
- Standard exception policy.
-
getConglomerateDescriptorList
public ConglomerateDescriptorList getConglomerateDescriptorList()
Gets the conglomerate descriptor list- Returns:
- The conglomerate descriptor list for this table descriptor
-
getViewDescriptor
public ViewDescriptor getViewDescriptor()
Gets the view descriptor for this TableDescriptor.- Returns:
- ViewDescriptor The ViewDescriptor, if any.
-
setViewDescriptor
public void setViewDescriptor(ViewDescriptor viewDescriptor)
Set (cache) the view descriptor for this TableDescriptor- Parameters:
viewDescriptor
- The view descriptor to cache.
-
isPersistent
public boolean isPersistent()
Is this provider persistent? A stored dependency will be required if both the dependent and provider are persistent.- Specified by:
isPersistent
in interfaceDependable
- Overrides:
isPersistent
in classTupleDescriptor
- Returns:
- boolean Whether or not this provider is persistent.
-
isSynonymDescriptor
public boolean isSynonymDescriptor()
Is this descriptor represents a synonym?- Returns:
- boolean Whether or not this represents a synonym
-
getTotalNumberOfIndexes
public int getTotalNumberOfIndexes() throws StandardException
Gets the number of indexes on the table, including the backing indexes.- Returns:
- the number of columns in the table.
- Throws:
StandardException
- See Also:
getQualifiedNumberOfIndexes(int, boolean)
-
getQualifiedNumberOfIndexes
public int getQualifiedNumberOfIndexes(int minColCount, boolean nonUniqeTrumpsColCount)
Returns the number of indexes matching the criteria.- Parameters:
minColCount
- the minimum number of ordered columns in the indexes we want to countnonUniqeTrumpsColCount
- iftrue
a non-unique index will be included in the count even if it has less thanminColCount
ordered columns- Returns:
- Number of matching indexes.
- See Also:
getTotalNumberOfIndexes()
-
getAllRelevantTriggers
public void getAllRelevantTriggers(int statementType, int[] changedColumnIds, TriggerDescriptorList relevantTriggers) throws StandardException
Builds a list of all triggers which are relevant to a given statement type, given a list of updated columns.- Parameters:
statementType
- defined in StatementTypechangedColumnIds
- array of changed columnsrelevantTriggers
- IN/OUT. Passed in as an empty list. Filled in as we go.- Throws:
StandardException
- Thrown on error
-
getAllRelevantConstraints
public void getAllRelevantConstraints(int statementType, int[] changedColumnIds, boolean[] needsDeferredProcessing, ConstraintDescriptorList relevantConstraints) throws StandardException
Gets all of the relevant constraints for a statement, given its statement type and its list of updated columns.- Parameters:
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.- Throws:
StandardException
- Thrown on error
-
getDependableFinder
public DependableFinder getDependableFinder()
Description copied from interface:Dependable
Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.- Specified by:
getDependableFinder
in interfaceDependable
- Returns:
- the stored form of this provider
- See Also:
Dependable.getDependableFinder()
-
getObjectName
public java.lang.String getObjectName()
Return the name of this Provider. (Useful for errors.)- Specified by:
getObjectName
in interfaceDependable
- Returns:
- String The name of this provider.
-
getObjectID
public UUID getObjectID()
Get the provider's UUID- Specified by:
getObjectID
in interfaceDependable
- Returns:
- String The provider's UUID
-
getClassType
public java.lang.String getClassType()
Get the provider's type.- Specified by:
getClassType
in interfaceDependable
- Returns:
- String The provider's type.
-
toString
public java.lang.String toString()
Prints the contents of the TableDescriptor- Overrides:
toString
in classjava.lang.Object
- Returns:
- The contents as a String
-
getColumnDescriptorList
public ColumnDescriptorList getColumnDescriptorList()
Gets the column descriptor list- Returns:
- The column descriptor list for this table descriptor
-
getGeneratedColumns
public ColumnDescriptorList getGeneratedColumns()
Gets the list of columns defined by generation clauses.
-
getColumnIDs
public int[] getColumnIDs(java.lang.String[] names)
Turn an array of column names into the corresponding 1-based column positions.
-
getConstraintDescriptorList
public ConstraintDescriptorList getConstraintDescriptorList() throws StandardException
Gets the constraint descriptor list- Returns:
- The constraint descriptor list for this table descriptor
- Throws:
StandardException
- Thrown on failure
-
setConstraintDescriptorList
public void setConstraintDescriptorList(ConstraintDescriptorList newCDL)
Sets the constraint descriptor list- Parameters:
newCDL
- The new constraint descriptor list for this table descriptor
-
emptyConstraintDescriptorList
public void emptyConstraintDescriptorList() throws StandardException
Empty the constraint descriptor list- Throws:
StandardException
- Thrown on failure
-
getPrimaryKey
public ReferencedKeyConstraintDescriptor getPrimaryKey() throws StandardException
Gets the primary key, may return null if no primary key- Returns:
- The priamry key or null
- Throws:
StandardException
- Thrown on failure
-
getTriggerDescriptorList
public TriggerDescriptorList getTriggerDescriptorList() throws StandardException
Gets the trigger descriptor list- Returns:
- The trigger descriptor list for this table descriptor
- Throws:
StandardException
- Thrown on failure
-
setTriggerDescriptorList
public void setTriggerDescriptorList(TriggerDescriptorList newCDL)
Sets the trigger descriptor list- Parameters:
newCDL
- The new trigger descriptor list for this table descriptor
-
emptyTriggerDescriptorList
public void emptyTriggerDescriptorList() throws StandardException
Empty the trigger descriptor list- Throws:
StandardException
- Thrown on failure
-
tableNameEquals
public boolean tableNameEquals(java.lang.String otherTableName, java.lang.String otherSchemaName)
Compare the tables descriptors based on the names. Null schema names match.- Parameters:
otherTableName
- the other table nameotherSchemaName
- the other schema name- Returns:
- boolean Whether or not the 2 TableNames are equal.
-
removeConglomerateDescriptor
public void removeConglomerateDescriptor(ConglomerateDescriptor cd) throws StandardException
Remove this descriptor- Parameters:
cd
- The conglomerate descriptor- Throws:
StandardException
- on error
-
removeConstraintDescriptor
public void removeConstraintDescriptor(ConstraintDescriptor cd) throws StandardException
Remove this descriptor. Warning, removes by using object reference, not uuid.- Parameters:
cd
- constraint descriptor- Throws:
StandardException
- on error
-
getColumnDescriptor
public 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). Returns NULL for columns that do not exist.- Parameters:
columnName
- A String containing the name of the column- Returns:
- A ColumnDescriptor describing the column
-
getColumnDescriptor
public ColumnDescriptor getColumnDescriptor(int columnNumber)
- Parameters:
columnNumber
- The ordinal (1-based) position of the column in the table- Returns:
- A ColumnDescriptor describing the column
-
getConglomerateDescriptors
public ConglomerateDescriptor[] getConglomerateDescriptors()
Gets a ConglomerateDescriptor[] to loop through all the conglomerate descriptors for the table.- Returns:
- A ConglomerateDescriptor[] for looping through the table's conglomerates
-
getConglomerateDescriptor
public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber) throws StandardException
Gets a conglomerate descriptor for the given table and conglomerate number.- Parameters:
conglomerateNumber
- The conglomerate number we're interested in- Returns:
- A ConglomerateDescriptor describing the requested conglomerate. Returns NULL if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptors
public ConglomerateDescriptor[] getConglomerateDescriptors(long conglomerateNumber) throws StandardException
Gets array of conglomerate descriptors for the given table and conglomerate number. More than one descriptors if duplicate indexes share one conglomerate.- Parameters:
conglomerateNumber
- The conglomerate number we're interested in- Returns:
- Array of ConglomerateDescriptors with the requested conglomerate number. Returns size 0 array if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptor
public ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID) throws StandardException
Gets a conglomerate descriptor for the given table and conglomerate UUID String.- Parameters:
conglomerateUUID
- The UUID for the conglomerate we're interested in- Returns:
- A ConglomerateDescriptor describing the requested conglomerate. Returns NULL if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptors
public ConglomerateDescriptor[] getConglomerateDescriptors(UUID conglomerateUUID) throws StandardException
Gets array of conglomerate descriptors for the given table and conglomerate UUID. More than one descriptors if duplicate indexes share one conglomerate.- Parameters:
conglomerateUUID
- The conglomerate UUID we're interested in- Returns:
- Array of ConglomerateDescriptors with the requested conglomerate UUID. Returns size 0 array if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getIndexLister
public IndexLister getIndexLister() throws StandardException
Gets an object which lists out all the index row generators on a table together with their conglomerate ids.- Returns:
- An object to list out the index row generators.
- Throws:
StandardException
- Thrown on failure
-
tableHasAutoincrement
public boolean tableHasAutoincrement()
Does the table have an auto-increment column or not?- Returns:
- TRUE if the table has at least one auto-increment column, false otherwise
-
getColumnNamesArray
public java.lang.String[] getColumnNamesArray()
Gets an array of column names.- Returns:
- An array, filled with the column names in the table.
-
getAutoincIncrementArray
public long[] getAutoincIncrementArray()
gets an array of increment values for autoincrement columns in the target table. If column is not an autoincrement column, then increment value is 0. If table has no autoincrement columns, returns NULL.- Returns:
- array containing the increment values of autoincrement columns.
-
getStatistics
public java.util.List<StatisticsDescriptor> getStatistics() throws StandardException
Returns a list of statistics for this table.- Throws:
StandardException
-
markForIndexStatsUpdate
public void markForIndexStatsUpdate(long tableRowCountEstimate) throws StandardException
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.- Parameters:
tableRowCountEstimate
- row count estimate for this table- Throws:
StandardException
- if obtaining index statistics fails
-
getAndClearIndexStatsIsUpToDate
public boolean getAndClearIndexStatsIsUpToDate()
Tells if the index statistics for the indexes associated with this table are consideres up-to-date, and clears the state.- Returns:
true
if the statistics are considered up-to-date,false
if not.
-
getIndexStatsUpdateReason
public java.lang.String getIndexStatsUpdateReason()
Returns the update criteria telling why the statistics are considered stale.This method is used for debugging.
- Returns:
- A string describing the update criteria that were met.
-
statisticsExist
public boolean statisticsExist(ConglomerateDescriptor cd) throws StandardException
Are there statistics for this particular conglomerate.- Parameters:
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.- Throws:
StandardException
-
selectivityForConglomerate
public double selectivityForConglomerate(ConglomerateDescriptor cd, int numKeys) throws StandardException
For this conglomerate (index), return the selectivity of the first numKeys. This basically returns the reciprocal of the number of unique values in the leading numKey columns of the index. It is assumed that statistics exist for the conglomerate if this function is called. However, no locks are held to prevent the statistics from being dropped, so the method also handles the case of missing statistics by using a heuristic to estimate the selectivity.- Parameters:
cd
- ConglomerateDescriptor (Index) whose cardinality we are interested in.numKeys
- Number of leading columns of the index for which cardinality is desired.- Throws:
StandardException
-
getDescriptorName
public java.lang.String getDescriptorName()
- Overrides:
getDescriptorName
in classTupleDescriptor
- See Also:
TupleDescriptor.getDescriptorName()
-
getDescriptorType
public java.lang.String getDescriptorType()
Description copied from class:TupleDescriptor
Each descriptor must identify itself with its type; i.e index, check constraint whatever.- Overrides:
getDescriptorType
in classTupleDescriptor
- See Also:
TupleDescriptor.getDescriptorType()
-
isValid
public boolean isValid()
Check that all of the dependent's dependencies are valid.
-
prepareToInvalidate
public void prepareToInvalidate(Provider p, int action, LanguageConnectionContext lcc) throws StandardException
Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).- Specified by:
prepareToInvalidate
in interfaceDependent
- Parameters:
action
- The action causing the invalidationp
- the providerlcc
- The LanguageConnectionContext- Throws:
StandardException
- thrown if unable to make it invalid
-
makeInvalid
public void makeInvalid(int action, LanguageConnectionContext lcc) throws StandardException
Mark the dependent as invalid (due to at least one of its dependencies being invalid). Always an error for a table -- should never have gotten here.- Specified by:
makeInvalid
in interfaceDependent
- Parameters:
action
- The action causing the invalidationlcc
- The LanguageConnectionContext- Throws:
StandardException
- thrown if called in sanity mode
-
makeSequenceName
public static java.lang.String makeSequenceName(UUID tableID)
Make the name of an identity sequence generator from a table ID
-
getContextOrNull
private static Context getContextOrNull(java.lang.String contextID)
Privileged lookup of a Context. Must be private so that user code can't call this entry point.
-
-