org.apache.derby.iapi.sql.dictionary
Class TableDescriptor

java.lang.Object
  extended by org.apache.derby.iapi.sql.dictionary.TupleDescriptor
      extended by org.apache.derby.iapi.sql.dictionary.TableDescriptor
All Implemented Interfaces:
Dependable, Dependent, Provider, UniqueSQLObjectDescriptor, UniqueTupleDescriptor

public class TableDescriptor
extends TupleDescriptor
implements UniqueSQLObjectDescriptor, Provider, Dependent

This class represents a table descriptor. The external interface to this class is:

  1. external interface
  2. public String getSchemaName();
  3. public String getQualifiedName();
  4. public int getTableType();
  5. public long getHeapConglomerateId() throws StandardException;
  6. public int getNumberOfColumns();
  7. public FormatableBitSet getReferencedColumnMap();
  8. public void setReferencedColumnMap(FormatableBitSet referencedColumnMap);
  9. public int getMaxColumnID() throws StandardException;
  10. public void setUUID(UUID uuid);
  11. public char getLockGranularity();
  12. public void setTableName(String newTableName);
  13. public void setLockGranularity(char lockGranularity);
  14. public ExecRow getEmptyExecRow( ContextManager cm) throws StandardException;
  15. public boolean tableNameEquals(String otherSchemaName, String otherTableName);
  16. public ReferencedKeyConstraintDescriptor getPrimaryKey() throws StandardException;
  17. public void removeConglomerateDescriptor(ConglomerateDescriptor cd) throws StandardException;
  18. public void removeConstraintDescriptor(ConstraintDescriptor cd) throws StandardException;
  19. public void getAffectedIndexes(...) throws StandardException;
  20. public void getAllRelevantTriggers(...) throws StandardException;
  21. public void getAllRelevantConstraints(...) throws StandardException
  22. public ColumnDescriptorList getColumnDescriptorList();
  23. public String[] getColumnNamesArray();
  24. public long[] getAutoincIncrementArray();
  25. public ColumnDescriptor getColumnDescriptor(String columnName);
  26. public ColumnDescriptor getColumnDescriptor(int columnNumber);
  27. public ConglomerateDescriptor[] getConglomerateDescriptors() throws StandardException;
  28. public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber) throws StandardException;
  29. public ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID) throws StandardException;
  30. public IndexLister getIndexLister() throws StandardException;
  31. public ViewDescriptor getViewDescriptor();
  32. public boolean tableHasAutoincrement();
  33. public boolean statisticsExist(ConglomerateDescriptor cd) throws StandardException;
  34. public double selectivityForConglomerate(...)throws StandardException;


Field Summary
static int BASE_TABLE_TYPE
           
(package private)  ColumnDescriptorList columnDescriptorList
           
(package private)  ConglomerateDescriptorList conglomerateDescriptorList
           
(package private)  ConstraintDescriptorList constraintDescriptorList
           
static char DEFAULT_LOCK_GRANULARITY
           
static int GLOBAL_TEMPORARY_TABLE_TYPE
           
(package private)  long heapConglomNumber
           
private  char lockGranularity
           
(package private)  UUID oid
           
private  boolean onCommitDeleteRows
           
private  boolean onRollbackDeleteRows
           
private static java.lang.ThreadLocal referencedColumnMap
          referencedColumnMap is thread local (since DERBY-2861) It contains a weak hash map keyed by the the TableDescriptor and the value is the actual referencedColumnMap bitmap.
static char ROW_LOCK_GRANULARITY
           
(package private)  SchemaDescriptor schema
           
private  java.util.List statisticsDescriptorList
          A list of statistics pertaining to this table--
static int SYNONYM_TYPE
           
static int SYSTEM_TABLE_TYPE
           
static char TABLE_LOCK_GRANULARITY
           
(package private)  java.lang.String tableName
           
(package private)  int tableType
           
private  GenericDescriptorList triggerDescriptorList
           
static int VIEW_TYPE
           
(package private)  ViewDescriptor viewDescriptor
           
static int VTI_TYPE
           
 
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.
 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.
 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.
 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.
private  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 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

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

lockGranularity

private char lockGranularity

onCommitDeleteRows

private boolean onCommitDeleteRows

onRollbackDeleteRows

private boolean onRollbackDeleteRows

schema

SchemaDescriptor schema

tableName

java.lang.String tableName

oid

UUID oid

tableType

int tableType

heapConglomNumber

long heapConglomNumber

columnDescriptorList

ColumnDescriptorList columnDescriptorList

conglomerateDescriptorList

ConglomerateDescriptorList conglomerateDescriptorList

constraintDescriptorList

ConstraintDescriptorList constraintDescriptorList

triggerDescriptorList

private GenericDescriptorList triggerDescriptorList

viewDescriptor

ViewDescriptor viewDescriptor

referencedColumnMap

private static java.lang.ThreadLocal referencedColumnMap
referencedColumnMap is thread local (since DERBY-2861) It contains a weak hash map keyed by the the TableDescriptor and the value is the actual referencedColumnMap bitmap. So, each thread has a weak hash map it uses to find the appropriate referencedColumnMap for 'this' TableDescriptor. Since the hash map is weak, when the TableDescriptor is no longer referenced the hash entry can be garbage collected (it is the *key* of a weak hash map that is weak, not the value).


statisticsDescriptorList

private java.util.List 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 in
tableName - The name of the temporary table
schema - The schema descriptor for this table.
tableType - An integer identifier for the type of the table : declared global temporary table
onCommitDeleteRows - 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 in
tableName - The name of the table
schema - 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 interface UniqueSQLObjectDescriptor
Returns:
SchemaDescriptor The SchemaDescriptor.

getName

public java.lang.String getName()
Gets the name of the table.

Specified by:
getName in interface UniqueSQLObjectDescriptor
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 interface UniqueTupleDescriptor
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 interface Dependable
Overrides:
isPersistent in class TupleDescriptor
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

getAllRelevantTriggers

public void getAllRelevantTriggers(int statementType,
                                   int[] changedColumnIds,
                                   GenericDescriptorList 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 StatementType
changedColumnIds - array of changed columns
relevantTriggers - IN/OUT. Passed in as an empty list. Filled in as we go.
Throws:
StandardException - Thrown on error

getAllRelevantConstraints

public void getAllRelevantConstraints(int statementType,
                                      boolean skipCheckConstraints,
                                      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.
skipCheckConstraints - Skip check constraints
changedColumnIds - If null, all columns being changed, otherwise array of 1-based column ids for columns being changed
needsDeferredProcessing - IN/OUT. true if the statement already needs deferred processing. set while evaluating this routine if a trigger or constraint requires deferred processing
relevantConstraints - 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 interface Dependable
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 interface Dependable
Returns:
String The name of this provider.

getObjectID

public UUID getObjectID()
Get the provider's UUID

Specified by:
getObjectID in interface Dependable
Returns:
String The provider's UUID

getClassType

public java.lang.String getClassType()
Get the provider's type.

Specified by:
getClassType in interface Dependable
Returns:
String The provider's type.

toString

public java.lang.String toString()
Prints the contents of the TableDescriptor

Overrides:
toString in class java.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 GenericDescriptorList 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(GenericDescriptorList 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 name
otherSchemaName - 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 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
Throws:
StandardException - Thrown on failure

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 autoincrement column or not?

Returns:
TRUE if the table has atleast one autoincrement 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

private java.util.List getStatistics()
                              throws StandardException
Returns a list of statistics for this table.

Throws:
StandardException

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.

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 class TupleDescriptor
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 class TupleDescriptor
See Also:
TupleDescriptor.getDescriptorType()

isValid

public boolean isValid()
Check that all of the dependent's dependencies are valid.

Specified by:
isValid in interface Dependent
Returns:
true if the dependent is currently 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 interface Dependent
Parameters:
action - The action causing the invalidation
p - the provider
lcc - 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 interface Dependent
Parameters:
action - The action causing the invalidation
lcc - The LanguageConnectionContext
Throws:
StandardException - thrown if called in sanity mode

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.