org.apache.derby.iapi.sql.dictionary
Interface DataDictionary

All Known Implementing Classes:
DataDictionaryImpl

public interface DataDictionary

The DataDictionary interface is used with the data dictionary to get descriptors for binding and compilation. Some descriptors (such as table and column descriptors) are added to and deleted from the data dictionary by other modules (like the object store). Other descriptors are added and deleted by the language module itself (e.g. the language module adds and deletes views, because views are too high-level for modules like the object store to know about).

Version:
0.1
Author:
Jeff Lichtman

Field Summary
static int CHECK_CONSTRAINT
           
static int COMPILE_ONLY_MODE
          Modes returned from startReading()
static java.lang.String CORE_DATA_DICTIONARY_VERSION
           
static java.lang.String CREATE_DATA_DICTIONARY_VERSION
           
static java.lang.String DATABASE_ID
           
static int DD_VERSION_CS_10_0
          Cloudscape 10.0 (Gandalf) System Catalog version
static int DD_VERSION_CS_5_0
          Cloudscape 5.0 System Catalog version
static int DD_VERSION_CS_5_1
          Cloudscape 5.1 (Arwen) System Catalog version
static int DD_VERSION_CS_5_2
          Cloudscape 5.2 (Frodo) System Catalog version
static int DD_VERSION_CS_8_1
          Cloudscape 8.1 (Pre-Gandalf) System Catalog version
static int DD_VERSION_CURRENT
          Special version indicating the database must be upgraded to or created at the current engine level
static int DDL_MODE
           
static int DROP_CONSTRAINT
           
static int FOREIGNKEY_CONSTRAINT
           
static java.lang.String MODULE
           
static int NOTNULL_CONSTRAINT
           
static int PRIMARYKEY_CONSTRAINT
           
static java.lang.String PROPERTY_CONGLOMERATE_VERSION
           
static java.lang.String SOFT_DATA_DICTIONARY_VERSION
           
static int SYSALIASES_CATALOG_NUM
           
static int SYSCHECKS_CATALOG_NUM
           
static int SYSCOLUMNS_CATALOG_NUM
           
static int SYSCONGLOMERATES_CATALOG_NUM
           
static int SYSCONSTRAINTS_CATALOG_NUM
          Catalog numbers for non core system catalogs.
static int SYSDEPENDS_CATALOG_NUM
           
static int SYSDUMMY1_CATALOG_NUM
           
static int SYSFILES_CATALOG_NUM
           
static int SYSFOREIGNKEYS_CATALOG_NUM
           
static int SYSKEYS_CATALOG_NUM
           
static int SYSSCHEMAS_CATALOG_NUM
           
static int SYSSTATEMENTS_CATALOG_NUM
           
static int SYSSTATISTICS_CATALOG_NUM
           
static int SYSTABLES_CATALOG_NUM
           
static int SYSTRIGGERS_CATALOG_NUM
           
static int SYSVIEWS_CATALOG_NUM
           
static int UNIQUE_CONSTRAINT
           
 
Method Summary
 boolean activeConstraint(ConstraintDescriptor constraint)
          Reports whether an individual constraint must be enforced.
 void addConstraintDescriptor(ConstraintDescriptor descriptor, TransactionController tc)
          Adds the given ConstraintDescriptor to the data dictionary, associated with the given table and constraint type.
 void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent, int catalogNumber, boolean allowsDuplicates, TransactionController tc)
          Adds a descriptor to a system catalog identified by the catalogNumber.
 void addDescriptorArray(TupleDescriptor[] tuple, TupleDescriptor parent, int catalogNumber, boolean allowsDuplicates, TransactionController tc)
          array version of addDescriptor.
 void addSPSDescriptor(SPSDescriptor descriptor, TransactionController tc, boolean wait)
          Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.
 boolean checkVersion(int majorVersion, java.lang.String feature)
          Check to see if a database has been upgraded to the required level in order to use a langauge feature that is.
 void clearCaches()
          Clear all of the DataDictionary caches.
 RowLocation[] computeAutoincRowLocations(TransactionController tc, TableDescriptor td)
          returns an array of RowLocations corresponding to the autoincrement columns in the table.
 void doneReading(int mode, LanguageConnectionContext lcc)
          Inform this DataDictionary that we have finished reading it.
 void dropAliasDescriptor(AliasDescriptor ad, TransactionController tc)
          Drop an AliasDescriptor from the DataDictionary
 void dropAllColumnDescriptors(UUID tableID, TransactionController tc)
          Drops all column descriptors from the given table.
 void dropAllConglomerateDescriptors(TableDescriptor td, TransactionController tc)
          Drops all conglomerates associated with a table.
 void dropAllConstraintDescriptors(TableDescriptor table, TransactionController tc)
          Drops all ConstraintDescriptors from the data dictionary that are associated with the given table.
 void dropColumnDescriptor(UUID tableID, java.lang.String columnName, TransactionController tc)
          Given a column name and a table ID, drops the column descriptor from the table.
 void dropConglomerateDescriptor(ConglomerateDescriptor conglomerate, TransactionController tc)
          Drops a conglomerate descriptor
 void dropConstraintDescriptor(TableDescriptor table, ConstraintDescriptor descriptor, TransactionController tc)
          Drops the given ConstraintDescriptor that is associated with the given table and constraint type from the data dictionary.
 void dropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc)
          Remove all of the stored dependencies for a given dependent's ID from the data dictionary.
 void dropFileInfoDescriptor(FileInfoDescriptor fid)
          Drop a FileDescriptor from the datadictionary.
 void dropSchemaDescriptor(java.lang.String schemaName, TransactionController tc)
          Drop the descriptor for a schema, given the schema's name
 void dropSPSDescriptor(SPSDescriptor descriptor, TransactionController tc)
          Drops the given SPSDescriptor.
 void dropSPSDescriptor(UUID uuid, TransactionController tc)
          Drops the given SPSDescriptor.
 void dropStatisticsDescriptors(UUID tableUUID, UUID referenceUUID, TransactionController tc)
          Drops all statistics descriptors for a given table/index column combination.
 void dropStoredDependency(DependencyDescriptor dd, TransactionController tc)
          Drop a dependency from the data dictionary.
 void dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema, TransactionController tc)
          Drop the table descriptor.
 void dropTriggerDescriptor(TriggerDescriptor descriptor, TransactionController tc)
          Drops the given TriggerDescriptor that is associated with the given table and constraint type from the data dictionary.
 void dropViewDescriptor(ViewDescriptor viewDescriptor, TransactionController tc)
          Drops the view descriptor from the data dictionary.
 ConstraintDescriptorList getActiveConstraintDescriptors(ConstraintDescriptorList cdl)
          Convert a constraint descriptor list into a list of active constraints, that is, constraints which must be enforced.
 AliasDescriptor getAliasDescriptor(java.lang.String schemaID, java.lang.String aliasName, char nameSpace)
          Get a AliasDescriptor by alias name and name space.
 AliasDescriptor getAliasDescriptor(UUID uuid)
          Get an AliasDescriptor given its UUID.
 java.util.List getAllDependencyDescriptorsList()
          Build and return an List with DependencyDescriptors for all of the stored dependencies.
 java.util.List getAllSPSDescriptors()
          Get every statement in this database.
 int getCacheMode()
          Returns the cache mode of the data dictionary.
 ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid)
          Get a ColumnDescriptor given its Default ID.
 ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber)
          Get a ConglomerateDescriptor given its conglomerate number.
 ConglomerateDescriptor getConglomerateDescriptor(java.lang.String indexName, SchemaDescriptor sd, boolean forUpdate)
          Gets a conglomerate descriptor for the named index in the given schema, getting an exclusive row lock on the matching row in sys.sysconglomerates (for DDL concurrency) if requested.
 ConglomerateDescriptor getConglomerateDescriptor(UUID uuid)
          Get a ConglomerateDescriptor given its UUID.
 ConglomerateDescriptor[] getConglomerateDescriptors(long conglomerateNumber)
          Get an array of conglomerate descriptors for the given conglomerate number.
 ConglomerateDescriptor[] getConglomerateDescriptors(UUID uuid)
          Get an array of ConglomerateDescriptors given the UUID.
 ConstraintDescriptor getConstraintDescriptor(java.lang.String constraintName, UUID schemaID)
          Get a ConstraintDescriptor given its name and schema ID.
 ConstraintDescriptor getConstraintDescriptor(TableDescriptor td, UUID uuid)
          Get the constraint descriptor given a table and the UUID String of the backing index.
 ConstraintDescriptor getConstraintDescriptor(UUID uuid)
          Get a ConstraintDescriptor given its UUID.
 ConstraintDescriptor getConstraintDescriptorById(TableDescriptor td, UUID uuid)
          Get the constraint descriptor given a table and the UUID String of the constraint
 ConstraintDescriptor getConstraintDescriptorByName(TableDescriptor td, SchemaDescriptor sd, java.lang.String constraintName, boolean forUpdate)
          Get the constraint descriptor given a TableDescriptor and the constraint name.
 ConstraintDescriptorList getConstraintDescriptors(TableDescriptor td)
          Load up the constraint descriptor list for this table descriptor and return it.
 TableDescriptor getConstraintTableDescriptor(UUID constraintId)
          Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passsed in.
 TabInfo getCoreCatalog(int coreNum)
          Get core catalog info.
 DataDescriptorGenerator getDataDescriptorGenerator()
          Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.
 DataValueFactory getDataValueFactory()
          Get the DataValueFactory associated with this database.
 SchemaDescriptor getDeclaredGlobalTemporaryTablesSchemaDescriptor()
          Get the descriptor for the declared global temporary table schema which is always named "SESSION".
 DependencyManager getDependencyManager()
          Returns the dependency manager for this DataDictionary.
 java.util.List getDependentsDescriptorList(java.lang.String dependentID)
          Gets a list of the dependency descriptors for the given dependent's id.
 int getEngineType()
           
 ExecutionFactory getExecutionFactory()
          Get the ExecutionFactory associated with this database.
 FileInfoDescriptor getFileInfoDescriptor(SchemaDescriptor sd, java.lang.String name)
          Get a FileInfoDescriptor given its SQL name and schema name.
 FileInfoDescriptor getFileInfoDescriptor(UUID id)
          Get a FileInfoDescriptor given its id.
 ConstraintDescriptorList getForeignKeys(UUID constraintId)
          Return a list of foreign keys constraints referencing this constraint.
 java.util.List getProvidersDescriptorList(java.lang.String providerID)
          Gets a list of the dependency descriptors for the given provider's id.
 java.util.List getRoutineList(java.lang.String schemaID, java.lang.String routineName, char nameSpace)
          Get the list of routines matching the schema and routine name.
 RowLocation getRowLocationTemplate(LanguageConnectionContext lcc, TableDescriptor td)
           
 SchemaDescriptor getSchemaDescriptor(java.lang.String schemaName, TransactionController tc, boolean raiseError)
          Get the descriptor for the named schema.
 SchemaDescriptor getSchemaDescriptor(UUID schemaId, TransactionController tc)
          Get the descriptor for the named schema.
 NumberDataValue getSetAutoincrementValue(RowLocation rl, TransactionController tc, boolean doUpdate, NumberDataValue newValue, boolean wait)
          getSetAutoincrementValue fetches the autoincrement value from SYSCOLUMNS given a row location.
 SPSDescriptor getSPSDescriptor(java.lang.String name, SchemaDescriptor sd)
          Get the stored prepared statement descriptor given a sps name.
 SPSDescriptor getSPSDescriptor(UUID uuid)
          Get a SPSDescriptor given its UUID.
 DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, java.util.Vector defaults)
          Get all the parameter descriptors for an SPS.
 java.util.List getStatisticsDescriptors(TableDescriptor td)
          Gets all statistics Descriptors for a given table.
 SubKeyConstraintDescriptor getSubKeyConstraint(UUID constraintId, int type)
          Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for the specified constraint id.
 SchemaDescriptor getSysIBMSchemaDescriptor()
          Get the descriptor for the SYSIBM schema.
 SchemaDescriptor getSystemDiagSchemaDescriptor()
          Get the descriptor for the SYSCS_DIAG schema.
 SchemaDescriptor getSystemSchemaDescriptor()
          Get the descriptor for the system schema.
 java.lang.String getSystemSQLName()
          Returns a unique system generated name of the form SQLyymmddhhmmssxxn yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second, xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value, n - number between 0-9
 TabInfo getTabInfo(java.lang.String tableName)
          Get the tabinfo of a system catalog.
 TableDescriptor getTableDescriptor(java.lang.String tableName, SchemaDescriptor schema)
          Get the descriptor for the named table within the given schema.
 TableDescriptor getTableDescriptor(UUID tableID)
          Get the descriptor for the table with the given UUID.
 TriggerDescriptor getTriggerDescriptor(java.lang.String name, SchemaDescriptor sd)
          Get the stored prepared statement descriptor given a sps name.
 TriggerDescriptor getTriggerDescriptor(UUID uuid)
          Get a TriggerDescriptor given its UUID.
 GenericDescriptorList getTriggerDescriptors(TableDescriptor td)
          Load up the trigger descriptor list for this table descriptor and return it.
 UUIDFactory getUUIDFactory()
          Get the UUID Factory.
 ViewDescriptor getViewDescriptor(TableDescriptor td)
          Gets the viewDescriptor for the view given its TableDescriptor.
 ViewDescriptor getViewDescriptor(UUID uuid)
          Gets the viewDescriptor for the view with the given UUID.
 java.util.Hashtable hashAllConglomerateDescriptorsByNumber(TransactionController tc)
          Get all of the ConglomerateDescriptors in the database and hash them by conglomerate number.
 java.util.Hashtable hashAllTableDescriptorsByTableId(TransactionController tc)
          Get all of the TableDescriptors in the database and hash them by TableId This is useful as a performance optimization for the locking VTIs.
 void invalidateAllSPSPlans()
          Invalidate all the stored plans in SYS.SYSSTATEMENTS.
 boolean isSchemaEmpty(SchemaDescriptor sd)
          Indicate whether there is anything in the particular schema.
 boolean isSystemSchemaName(java.lang.String name)
          Determine whether a string is the name of the system schema.
 DataDictionaryContext pushDataDictionaryContext(ContextManager cm, boolean nested)
          Push a data dictionary context onto the current context manager.
 void setAutoincrementValue(TransactionController tc, UUID tableUUID, java.lang.String columnName, long aiValue, boolean incrementNeeded)
          sets a new value in SYSCOLUMNS for a particular autoincrement column.
 int startReading(LanguageConnectionContext lcc)
          Inform this DataDictionary that we are about to start reading it.
 void startWriting(LanguageConnectionContext lcc)
          Inform this DataDictionary that we are about to start writing to it.
 void transactionFinished()
          Inform this DataDictionary that the transaction in which writes have been done (or may have been done) has been committed or rolled back.
 void updateConglomerateDescriptor(ConglomerateDescriptor[] cds, long conglomerateNumber, TransactionController tc)
          Update the conglomerateNumber for an array of ConglomerateDescriptors.
 void updateConglomerateDescriptor(ConglomerateDescriptor cd, long conglomerateNumber, TransactionController tc)
          Update the conglomerateNumber for a ConglomerateDescriptor.
 void updateConstraintDescriptor(ConstraintDescriptor cd, UUID formerUUID, int[] colsToSet, TransactionController tc)
          Update the constraint descriptor in question.
 void updateLockGranularity(TableDescriptor td, SchemaDescriptor schema, char lockGranularity, TransactionController tc)
          Update the lockGranularity for the specified table.
 void updateSPS(SPSDescriptor spsd, TransactionController tc, boolean recompile, boolean updateSYSCOLUMNS, boolean wait, boolean firstCompilation)
          Updates SYS.SYSSTATEMENTS with the info from the SPSD.
 void updateTriggerDescriptor(TriggerDescriptor triggerd, UUID formerUUID, int[] colsToSet, TransactionController tc)
          Update the trigger descriptor in question.
 

Field Detail

MODULE

public static final java.lang.String MODULE
See Also:
Constant Field Values

DD_VERSION_CURRENT

public static final int DD_VERSION_CURRENT
Special version indicating the database must be upgraded to or created at the current engine level

See Also:
Constant Field Values

DD_VERSION_CS_5_0

public static final int DD_VERSION_CS_5_0
Cloudscape 5.0 System Catalog version

See Also:
Constant Field Values

DD_VERSION_CS_5_1

public static final int DD_VERSION_CS_5_1
Cloudscape 5.1 (Arwen) System Catalog version

See Also:
Constant Field Values

DD_VERSION_CS_5_2

public static final int DD_VERSION_CS_5_2
Cloudscape 5.2 (Frodo) System Catalog version

See Also:
Constant Field Values

DD_VERSION_CS_8_1

public static final int DD_VERSION_CS_8_1
Cloudscape 8.1 (Pre-Gandalf) System Catalog version

See Also:
Constant Field Values

DD_VERSION_CS_10_0

public static final int DD_VERSION_CS_10_0
Cloudscape 10.0 (Gandalf) System Catalog version

See Also:
Constant Field Values

DATABASE_ID

public static final java.lang.String DATABASE_ID
See Also:
Constant Field Values

CORE_DATA_DICTIONARY_VERSION

public static final java.lang.String CORE_DATA_DICTIONARY_VERSION
See Also:
Constant Field Values

CREATE_DATA_DICTIONARY_VERSION

public static final java.lang.String CREATE_DATA_DICTIONARY_VERSION
See Also:
Constant Field Values

SOFT_DATA_DICTIONARY_VERSION

public static final java.lang.String SOFT_DATA_DICTIONARY_VERSION
See Also:
Constant Field Values

PROPERTY_CONGLOMERATE_VERSION

public static final java.lang.String PROPERTY_CONGLOMERATE_VERSION
See Also:
Constant Field Values

SYSCONGLOMERATES_CATALOG_NUM

public static final int SYSCONGLOMERATES_CATALOG_NUM
See Also:
Constant Field Values

SYSTABLES_CATALOG_NUM

public static final int SYSTABLES_CATALOG_NUM
See Also:
Constant Field Values

SYSCOLUMNS_CATALOG_NUM

public static final int SYSCOLUMNS_CATALOG_NUM
See Also:
Constant Field Values

SYSSCHEMAS_CATALOG_NUM

public static final int SYSSCHEMAS_CATALOG_NUM
See Also:
Constant Field Values

SYSCONSTRAINTS_CATALOG_NUM

public static final int SYSCONSTRAINTS_CATALOG_NUM
Catalog numbers for non core system catalogs.

See Also:
Constant Field Values

SYSKEYS_CATALOG_NUM

public static final int SYSKEYS_CATALOG_NUM
See Also:
Constant Field Values

SYSDEPENDS_CATALOG_NUM

public static final int SYSDEPENDS_CATALOG_NUM
See Also:
Constant Field Values

SYSALIASES_CATALOG_NUM

public static final int SYSALIASES_CATALOG_NUM
See Also:
Constant Field Values

SYSVIEWS_CATALOG_NUM

public static final int SYSVIEWS_CATALOG_NUM
See Also:
Constant Field Values

SYSCHECKS_CATALOG_NUM

public static final int SYSCHECKS_CATALOG_NUM
See Also:
Constant Field Values

SYSFOREIGNKEYS_CATALOG_NUM

public static final int SYSFOREIGNKEYS_CATALOG_NUM
See Also:
Constant Field Values

SYSSTATEMENTS_CATALOG_NUM

public static final int SYSSTATEMENTS_CATALOG_NUM
See Also:
Constant Field Values

SYSFILES_CATALOG_NUM

public static final int SYSFILES_CATALOG_NUM
See Also:
Constant Field Values

SYSTRIGGERS_CATALOG_NUM

public static final int SYSTRIGGERS_CATALOG_NUM
See Also:
Constant Field Values

SYSSTATISTICS_CATALOG_NUM

public static final int SYSSTATISTICS_CATALOG_NUM
See Also:
Constant Field Values

SYSDUMMY1_CATALOG_NUM

public static final int SYSDUMMY1_CATALOG_NUM
See Also:
Constant Field Values

NOTNULL_CONSTRAINT

public static final int NOTNULL_CONSTRAINT
See Also:
Constant Field Values

PRIMARYKEY_CONSTRAINT

public static final int PRIMARYKEY_CONSTRAINT
See Also:
Constant Field Values

UNIQUE_CONSTRAINT

public static final int UNIQUE_CONSTRAINT
See Also:
Constant Field Values

CHECK_CONSTRAINT

public static final int CHECK_CONSTRAINT
See Also:
Constant Field Values

DROP_CONSTRAINT

public static final int DROP_CONSTRAINT
See Also:
Constant Field Values

FOREIGNKEY_CONSTRAINT

public static final int FOREIGNKEY_CONSTRAINT
See Also:
Constant Field Values

COMPILE_ONLY_MODE

public static final int COMPILE_ONLY_MODE
Modes returned from startReading()

See Also:
Constant Field Values

DDL_MODE

public static final int DDL_MODE
See Also:
Constant Field Values
Method Detail

pushDataDictionaryContext

public DataDictionaryContext pushDataDictionaryContext(ContextManager cm,
                                                       boolean nested)
Push a data dictionary context onto the current context manager.

Parameters:
nested - true iff this is a nested data dictionary context.

clearCaches

public void clearCaches()
                 throws StandardException
Clear all of the DataDictionary caches.

Throws:
StandardException - Standard Cloudscape error policy

startReading

public int startReading(LanguageConnectionContext lcc)
                 throws StandardException
Inform this DataDictionary that we are about to start reading it. This means using the various get methods in the DataDictionary. Generally, this is done during query compilation.

Parameters:
lcc - The LanguageConnectionContext to use.
Returns:
The mode that the reader will use, to be passed to doneReading() Either COMPILE_ONLY_MODE or DDL_MODE.
Throws:
StandardException - Thrown on error

doneReading

public void doneReading(int mode,
                        LanguageConnectionContext lcc)
                 throws StandardException
Inform this DataDictionary that we have finished reading it. This typically happens at the end of compilation.

Parameters:
mode - The mode that was returned by startReading().
lcc - The LanguageConnectionContext to use.
Throws:
StandardException - Thrown on error

startWriting

public void startWriting(LanguageConnectionContext lcc)
                  throws StandardException
Inform this DataDictionary that we are about to start writing to it. This means using the various add and drop methods in the DataDictionary. Generally, this is done during execution of DDL.

Parameters:
lcc - The LanguageConnectionContext to use.
Throws:
StandardException - Thrown on error

transactionFinished

public void transactionFinished()
                         throws StandardException
Inform this DataDictionary that the transaction in which writes have been done (or may have been done) has been committed or rolled back.

Throws:
StandardException - Thrown on error

getExecutionFactory

public ExecutionFactory getExecutionFactory()
Get the ExecutionFactory associated with this database.

Returns:
The ExecutionFactory

getDataValueFactory

public DataValueFactory getDataValueFactory()
Get the DataValueFactory associated with this database.

Returns:
The ExecutionFactory

getDataDescriptorGenerator

public DataDescriptorGenerator getDataDescriptorGenerator()
Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.

Returns:
A DataDescriptorGenerator

getTabInfo

public TabInfo getTabInfo(java.lang.String tableName)
                   throws StandardException
Get the tabinfo of a system catalog. Paw through the tabinfo arrays looking for the tabinfo corresponding to this table name. RESOLVE: This does not bother to fault in the TabInfo. It assumes it already has been faulted in. This seems odd.

Parameters:
tableName - name of table to get the TabInfo for.
Returns:
tabinfo corresponding to tablename
Throws:
StandardException - Thrown on error

getSchemaDescriptor

public SchemaDescriptor getSchemaDescriptor(java.lang.String schemaName,
                                            TransactionController tc,
                                            boolean raiseError)
                                     throws StandardException
Get the descriptor for the named schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this. Will check default schema for a match before scanning a system table.

Parameters:
schemaName - The name of the schema we're interested in. Must not be null.
tc - TransactionController
raiseError - whether an exception should be thrown if the schema does not exist.
Returns:
The descriptor for the schema. Can be null (not found) if raiseError is false.
Throws:
StandardException - Thrown on error

getSchemaDescriptor

public SchemaDescriptor getSchemaDescriptor(UUID schemaId,
                                            TransactionController tc)
                                     throws StandardException
Get the descriptor for the named schema. If the schemaId parameter is NULL, it gets the descriptor for the current (default) schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this.

Parameters:
schemaId - The id of the schema we're interested in. If the name is NULL, get the descriptor for the current schema.
tc - The transaction controller to us when scanning SYSSCHEMAS
Returns:
The descriptor for the schema.
Throws:
StandardException - Thrown on failure

getSystemSchemaDescriptor

public SchemaDescriptor getSystemSchemaDescriptor()
                                           throws StandardException
Get the descriptor for the system schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this.

Returns:
The descriptor for the schema.
Throws:
StandardException - Thrown on failure

getSysIBMSchemaDescriptor

public SchemaDescriptor getSysIBMSchemaDescriptor()
                                           throws StandardException
Get the descriptor for the SYSIBM schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this.

Returns:
The descriptor for the schema.
Throws:
StandardException - Thrown on failure

getSystemDiagSchemaDescriptor

public SchemaDescriptor getSystemDiagSchemaDescriptor()
                                               throws StandardException
Get the descriptor for the SYSCS_DIAG schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this.

Returns:
The descriptor for the schema.
Throws:
StandardException - Thrown on failure

getDeclaredGlobalTemporaryTablesSchemaDescriptor

public SchemaDescriptor getDeclaredGlobalTemporaryTablesSchemaDescriptor()
                                                                  throws StandardException
Get the descriptor for the declared global temporary table schema which is always named "SESSION". SQL92 allows a schema to specify a default character set - we will not support this.

Returns:
The descriptor for the schema.
Throws:
StandardException - Thrown on failure

isSystemSchemaName

public boolean isSystemSchemaName(java.lang.String name)
                           throws StandardException
Determine whether a string is the name of the system schema.

Parameters:
name -
Returns:
true or false
Throws:
StandardException - Thrown on failure

dropSchemaDescriptor

public void dropSchemaDescriptor(java.lang.String schemaName,
                                 TransactionController tc)
                          throws StandardException
Drop the descriptor for a schema, given the schema's name

Parameters:
schemaName - The name of the schema to drop
tc - Transaction Controller
Throws:
StandardException - Thrown on failure

isSchemaEmpty

public boolean isSchemaEmpty(SchemaDescriptor sd)
                      throws StandardException
Indicate whether there is anything in the particular schema. Checks for tables in the the schema, on the assumption that there cannot be any other objects in a schema w/o a table.

Returns:
true/false
Throws:
StandardException - on error

getTableDescriptor

public TableDescriptor getTableDescriptor(java.lang.String tableName,
                                          SchemaDescriptor schema)
                                   throws StandardException
Get the descriptor for the named table within the given schema. If the schema parameter is NULL, it looks for the table in the current (default) schema. Table descriptors include object ids, object types (table, view, etc.)

Parameters:
tableName - The name of the table to get the descriptor for
schema - The descriptor for the schema the table lives in. If null, use the current (default) schema.
Returns:
The descriptor for the table, null if table does not existe.
Throws:
StandardException - Thrown on failure

getTableDescriptor

public TableDescriptor getTableDescriptor(UUID tableID)
                                   throws StandardException
Get the descriptor for the table with the given UUID. NOTE: I'm assuming that the object store will define an UUID for persistent objects. I'm also assuming that UUIDs are unique across schemas, and that the object store will be able to do efficient lookups across schemas (i.e. that no schema descriptor parameter is needed).

Parameters:
tableID - The UUID of the table to get the descriptor for
Returns:
The descriptor for the table, null if the table does not exist.
Throws:
StandardException - Thrown on failure

dropTableDescriptor

public void dropTableDescriptor(TableDescriptor td,
                                SchemaDescriptor schema,
                                TransactionController tc)
                         throws StandardException
Drop the table descriptor.

Parameters:
schema - A descriptor for the schema the table is a part of. If this parameter is NULL, then the table is part of the current (default) schema
tc - TransactionController for the transaction
Returns:
Nothing
Throws:
StandardException - Thrown on error

updateLockGranularity

public void updateLockGranularity(TableDescriptor td,
                                  SchemaDescriptor schema,
                                  char lockGranularity,
                                  TransactionController tc)
                           throws StandardException
Update the lockGranularity for the specified table.

Parameters:
td - The TableDescriptor for the table
schema - The SchemaDescriptor for the table
lockGranularity - The new lockGranularity
tc - The TransactionController to use.
Returns:
Nothing.
Throws:
StandardException - Thrown on error

getColumnDescriptorByDefaultId

public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid)
                                                throws StandardException
Get a ColumnDescriptor given its Default ID.

Parameters:
uuid - The UUID of the default
Returns:
The ColumnDescriptor for the column.
Throws:
StandardException - Thrown on failure

dropColumnDescriptor

public void dropColumnDescriptor(UUID tableID,
                                 java.lang.String columnName,
                                 TransactionController tc)
                          throws StandardException
Given a column name and a table ID, drops the column descriptor from the table.

Parameters:
tableID - The UUID of the table to drop the column from
columnName - The name of the column to drop
tc - TransactionController for the transaction
Throws:
StandardException - Thrown on failure

dropAllColumnDescriptors

public void dropAllColumnDescriptors(UUID tableID,
                                     TransactionController tc)
                              throws StandardException
Drops all column descriptors from the given table. Useful for DROP TABLE.

Parameters:
tableID - The UUID of the table from which to drop all the column descriptors
tc - TransactionController for the transaction
Throws:
StandardException - Thrown on failure

getViewDescriptor

public ViewDescriptor getViewDescriptor(UUID uuid)
                                 throws StandardException
Gets the viewDescriptor for the view with the given UUID.

Parameters:
uuid - The UUID for the view
Returns:
A descriptor for the view
Throws:
StandardException - Thrown on error

getViewDescriptor

public ViewDescriptor getViewDescriptor(TableDescriptor td)
                                 throws StandardException
Gets the viewDescriptor for the view given its TableDescriptor.

Parameters:
td - The TableDescriptor for the view.
Returns:
A descriptor for the view
Throws:
StandardException - Thrown on error

dropViewDescriptor

public void dropViewDescriptor(ViewDescriptor viewDescriptor,
                               TransactionController tc)
                        throws StandardException
Drops the view descriptor from the data dictionary.

Parameters:
viewDescriptor - A descriptor for the view to be dropped
tc - TransactionController to use
Throws:
StandardException - Thrown on failure

getConstraintDescriptor

public ConstraintDescriptor getConstraintDescriptor(UUID uuid)
                                             throws StandardException
Get a ConstraintDescriptor given its UUID.

Parameters:
uuid - The UUID
Returns:
The ConstraintDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getConstraintDescriptor

public ConstraintDescriptor getConstraintDescriptor(java.lang.String constraintName,
                                                    UUID schemaID)
                                             throws StandardException
Get a ConstraintDescriptor given its name and schema ID.

Parameters:
constraintName - Constraint name.
schemaID - The schema UUID
Returns:
The ConstraintDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getConstraintDescriptors

public ConstraintDescriptorList getConstraintDescriptors(TableDescriptor td)
                                                  throws StandardException
Load up the constraint descriptor list for this table descriptor and return it. If the descriptor list is already loaded up, it is retuned without further ado.

Returns:
The ConstraintDescriptorList for the table
Throws:
StandardException - Thrown on failure

getActiveConstraintDescriptors

public ConstraintDescriptorList getActiveConstraintDescriptors(ConstraintDescriptorList cdl)
                                                        throws StandardException
Convert a constraint descriptor list into a list of active constraints, that is, constraints which must be enforced. For the Core product, these are just the constraints on the original list. However, during REFRESH we may have deferred some constraints until statement end. This method returns the corresponding list of constraints which AREN'T deferred.

Parameters:
cdl - The constraint descriptor list to wrap with an Active constraint descriptor list.
Returns:
The corresponding Active ConstraintDescriptorList
Throws:
StandardException - Thrown on failure

activeConstraint

public boolean activeConstraint(ConstraintDescriptor constraint)
                         throws StandardException
Reports whether an individual constraint must be enforced. For the Core product, this routine always returns true. However, during REFRESH we may have deferred some constraints until statement end. This method returns false if the constraint deferred

Parameters:
constraint - the constraint to check
Returns:
The corresponding Active ConstraintDescriptorList
Throws:
StandardException - Thrown on failure

getConstraintDescriptor

public ConstraintDescriptor getConstraintDescriptor(TableDescriptor td,
                                                    UUID uuid)
                                             throws StandardException
Get the constraint descriptor given a table and the UUID String of the backing index.

Parameters:
uuid - The UUID for the backing index.
Returns:
The ConstraintDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getConstraintDescriptorById

public ConstraintDescriptor getConstraintDescriptorById(TableDescriptor td,
                                                        UUID uuid)
                                                 throws StandardException
Get the constraint descriptor given a table and the UUID String of the constraint

Parameters:
uuid - The UUID for the constraint
Returns:
The ConstraintDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getConstraintDescriptorByName

public ConstraintDescriptor getConstraintDescriptorByName(TableDescriptor td,
                                                          SchemaDescriptor sd,
                                                          java.lang.String constraintName,
                                                          boolean forUpdate)
                                                   throws StandardException
Get the constraint descriptor given a TableDescriptor and the constraint name.

Parameters:
sd - The schema descriptor for the constraint
constraintName - The constraint name.
forUpdate - Whether or not access is for update
Returns:
The ConstraintDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getConstraintTableDescriptor

public TableDescriptor getConstraintTableDescriptor(UUID constraintId)
                                             throws StandardException
Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passsed in.

Parameters:
constraintId - The id of the constraint
Returns:
the corresponding table descriptor
Throws:
StandardException - Thrown on error

getForeignKeys

public ConstraintDescriptorList getForeignKeys(UUID constraintId)
                                        throws StandardException
Return a list of foreign keys constraints referencing this constraint. Returns both enabled and disabled constraints.

Parameters:
constraintId - The id of the referenced constraint
Returns:
list of constraints
Throws:
StandardException - Thrown on error

addConstraintDescriptor

public void addConstraintDescriptor(ConstraintDescriptor descriptor,
                                    TransactionController tc)
                             throws StandardException
Adds the given ConstraintDescriptor to the data dictionary, associated with the given table and constraint type.

Parameters:
descriptor - The descriptor to add
tc - The transaction controller
Returns:
Nothing
Throws:
StandardException - Thrown on error

dropConstraintDescriptor

public void dropConstraintDescriptor(TableDescriptor table,
                                     ConstraintDescriptor descriptor,
                                     TransactionController tc)
                              throws StandardException
Drops the given ConstraintDescriptor that is associated with the given table and constraint type from the data dictionary. NOTE: Caller is responsible for dropping any backing index

Parameters:
table - The table from which to drop the constraint descriptor
descriptor - The descriptor to drop
tc - The TransactionController.
Throws:
StandardException - Thrown on failure

dropAllConstraintDescriptors

public void dropAllConstraintDescriptors(TableDescriptor table,
                                         TransactionController tc)
                                  throws StandardException
Drops all ConstraintDescriptors from the data dictionary that are associated with the given table. NOTE: Caller is responsible for dropping any backing index

Parameters:
table - The table from which to drop all constraint descriptors
tc - The TransactionController.
Throws:
StandardException - Thrown on failure

updateConstraintDescriptor

public void updateConstraintDescriptor(ConstraintDescriptor cd,
                                       UUID formerUUID,
                                       int[] colsToSet,
                                       TransactionController tc)
                                throws StandardException
Update the constraint descriptor in question. Updates every row in the base conglomerate.

Parameters:
cd - The Constraintescriptor
formerUUID - The UUID for this column in SYSCONSTRAINTS, may differ from what is in cd if this is the column that is being set.
colsToSet - Array of ints of columns to be modified, 1 based. May be null (all cols).
tc - The TransactionController to use
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

getSubKeyConstraint

public SubKeyConstraintDescriptor getSubKeyConstraint(UUID constraintId,
                                                      int type)
                                               throws StandardException
Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for the specified constraint id. For primary foreign and and unique key constraints.

Parameters:
constraintId - The UUID for the constraint.
type - The type of the constraint (e.g. DataDictionary.FOREIGNKEY_CONSTRAINT)
Returns:
SubKeyConstraintDescriptor The Sub descriptor for the constraint.
Throws:
StandardException - Thrown on failure

getSPSDescriptor

public SPSDescriptor getSPSDescriptor(UUID uuid)
                               throws StandardException
Get a SPSDescriptor given its UUID.

Parameters:
uuid - The UUID
Returns:
The SPSDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getSPSDescriptor

public SPSDescriptor getSPSDescriptor(java.lang.String name,
                                      SchemaDescriptor sd)
                               throws StandardException
Get the stored prepared statement descriptor given a sps name.

Parameters:
name - The sps name.
sd - The schema descriptor.
Returns:
The SPSDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getAllSPSDescriptors

public java.util.List getAllSPSDescriptors()
                                    throws StandardException
Get every statement in this database. Return the SPSDescriptors in an list.

Returns:
the list of descriptors
Throws:
StandardException - Thrown on failure

getSPSParams

public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd,
                                         java.util.Vector defaults)
                                  throws StandardException
Get all the parameter descriptors for an SPS. Look up the params in SYSCOLUMNS and turn them into parameter descriptors.

Parameters:
spsd - sps descriptor
defaults - the parameter defaults. If not null, all the parameter defaults will be stuffed in here.
Returns:
array of data type descriptors
Throws:
StandardException - Thrown on error

addSPSDescriptor

public void addSPSDescriptor(SPSDescriptor descriptor,
                             TransactionController tc,
                             boolean wait)
                      throws StandardException
Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.

Parameters:
descriptor - The descriptor to add
tc - The transaction controller
wait - To wait for lock or not
Returns:
Nothing
Throws:
StandardException - Thrown on error

updateSPS

public void updateSPS(SPSDescriptor spsd,
                      TransactionController tc,
                      boolean recompile,
                      boolean updateSYSCOLUMNS,
                      boolean wait,
                      boolean firstCompilation)
               throws StandardException
Updates SYS.SYSSTATEMENTS with the info from the SPSD.

Parameters:
tc - The transaction controller
recompile - whether to recompile or invalidate
updateSYSCOLUMNS - indicate whether syscolumns needs to be updated or not.
wait - If true, then the caller wants to wait for locks. False will be
firstCompilation - first time SPS is getting compiled. when we using a nested user xaction - we want to timeout right away if the parent holds the lock. (bug 4821)
Returns:
Nothing
Throws:
StandardException - Thrown on error

dropSPSDescriptor

public void dropSPSDescriptor(SPSDescriptor descriptor,
                              TransactionController tc)
                       throws StandardException
Drops the given SPSDescriptor.

Parameters:
descriptor - The descriptor to drop
tc - The TransactionController.
Throws:
StandardException - Thrown on failure

dropSPSDescriptor

public void dropSPSDescriptor(UUID uuid,
                              TransactionController tc)
                       throws StandardException
Drops the given SPSDescriptor.

Parameters:
uuid - the statement uuid
tc - The TransactionController.
Throws:
StandardException - Thrown on failure

invalidateAllSPSPlans

public void invalidateAllSPSPlans()
                           throws StandardException
Invalidate all the stored plans in SYS.SYSSTATEMENTS.

Throws:
StandardException - Thrown on error

getTriggerDescriptor

public TriggerDescriptor getTriggerDescriptor(UUID uuid)
                                       throws StandardException
Get a TriggerDescriptor given its UUID.

Parameters:
uuid - The UUID
Returns:
The TriggerDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getTriggerDescriptor

public TriggerDescriptor getTriggerDescriptor(java.lang.String name,
                                              SchemaDescriptor sd)
                                       throws StandardException
Get the stored prepared statement descriptor given a sps name.

Parameters:
name - The sps name.
sd - The schema descriptor.
Returns:
The TriggerDescriptor for the constraint.
Throws:
StandardException - Thrown on failure

getTriggerDescriptors

public GenericDescriptorList getTriggerDescriptors(TableDescriptor td)
                                            throws StandardException
Load up the trigger descriptor list for this table descriptor and return it. If the descriptor list is already loaded up, it is retuned without further ado.

Returns:
The ConstraintDescriptorList for the table
Throws:
StandardException - Thrown on failure

updateTriggerDescriptor

public void updateTriggerDescriptor(TriggerDescriptor triggerd,
                                    UUID formerUUID,
                                    int[] colsToSet,
                                    TransactionController tc)
                             throws StandardException
Update the trigger descriptor in question. Updates every row in the base conglomerate.

Parameters:
triggerd - The Triggerescriptor
formerUUID - The UUID for this column in SYSTRIGGERS, may differ from what is in triggerd if this is the column that is being set.
colsToSet - Array of ints of columns to be modified, 1 based. May be null (all cols).
tc - The TransactionController to use
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

dropTriggerDescriptor

public void dropTriggerDescriptor(TriggerDescriptor descriptor,
                                  TransactionController tc)
                           throws StandardException
Drops the given TriggerDescriptor that is associated with the given table and constraint type from the data dictionary.

Parameters:
descriptor - The descriptor to drop
tc - The TransactionController.
Throws:
StandardException - Thrown on failure

hashAllConglomerateDescriptorsByNumber

public java.util.Hashtable hashAllConglomerateDescriptorsByNumber(TransactionController tc)
                                                           throws StandardException
Get all of the ConglomerateDescriptors in the database and hash them by conglomerate number. This is useful as a performance optimization for the locking VTIs. NOTE: This method will scan SYS.SYSCONGLOMERATES at READ COMMITTED. It should really scan at READ UNCOMMITTED, but there is no such thing yet.

Parameters:
tc - TransactionController for the transaction
Returns:
A Hashtable with all of the ConglomerateDescriptors in the database hashed by conglomerate number.
Throws:
StandardException - Thrown on failure

hashAllTableDescriptorsByTableId

public java.util.Hashtable hashAllTableDescriptorsByTableId(TransactionController tc)
                                                     throws StandardException
Get all of the TableDescriptors in the database and hash them by TableId This is useful as a performance optimization for the locking VTIs. NOTE: This method will scan SYS.SYSTABLES at READ COMMITTED. It should really scan at READ UNCOMMITTED, but there is no such thing yet.

Parameters:
tc - TransactionController for the transaction
Returns:
A Hashtable with all of the Table descriptors in the database hashed by TableId
Throws:
StandardException - Thrown on failure

getConglomerateDescriptor

public ConglomerateDescriptor getConglomerateDescriptor(UUID uuid)
                                                 throws StandardException
Get a ConglomerateDescriptor given its UUID. If it is an index conglomerate shared by at least another duplicate index, this returns one of the ConglomerateDescriptors for those indexes.

Parameters:
uuid - The UUID
Returns:
A ConglomerateDescriptor for the conglomerate.
Throws:
StandardException - Thrown on failure

getConglomerateDescriptors

public ConglomerateDescriptor[] getConglomerateDescriptors(UUID uuid)
                                                    throws StandardException
Get an array of ConglomerateDescriptors given the UUID. If it is a heap conglomerate or an index conglomerate not shared by a duplicate index, the size of the return array is 1.

Parameters:
uuid - The UUID
Returns:
An array of ConglomerateDescriptors for the conglomerate.
Throws:
StandardException - Thrown on failure

getConglomerateDescriptor

public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber)
                                                 throws StandardException
Get a ConglomerateDescriptor given its conglomerate number. If it is an index conglomerate shared by at least another duplicate index, this returns one of the ConglomerateDescriptors for those indexes.

Parameters:
conglomerateNumber - The conglomerate number.
Returns:
A ConglomerateDescriptor for the conglomerate. Returns NULL if no such conglomerate.
Throws:
StandardException - Thrown on failure

getConglomerateDescriptors

public ConglomerateDescriptor[] getConglomerateDescriptors(long conglomerateNumber)
                                                    throws StandardException
Get an array of conglomerate descriptors for the given conglomerate number. If it is a heap conglomerate or an index conglomerate not shared by a duplicate index, the size of the return array is 1.

Parameters:
conglomerateNumber - The number for the conglomerate we're interested in
Returns:
An array of ConglomerateDescriptors that share the requested conglomerate. Returns size 0 array if no such conglomerate.
Throws:
StandardException - Thrown on failure

getConglomerateDescriptor

public ConglomerateDescriptor getConglomerateDescriptor(java.lang.String indexName,
                                                        SchemaDescriptor sd,
                                                        boolean forUpdate)
                                                 throws StandardException
Gets a conglomerate descriptor for the named index in the given schema, getting an exclusive row lock on the matching row in sys.sysconglomerates (for DDL concurrency) if requested.

Parameters:
indexName - The name of the index we're looking for
sd - The schema descriptor
forUpdate - Whether or not to get an exclusive row lock on the row in sys.sysconglomerates.
Returns:
A ConglomerateDescriptor describing the requested conglomerate. Returns NULL if no such conglomerate.
Throws:
StandardException - Thrown on failure

dropConglomerateDescriptor

public void dropConglomerateDescriptor(ConglomerateDescriptor conglomerate,
                                       TransactionController tc)
                                throws StandardException
Drops a conglomerate descriptor

Parameters:
conglomerate - The ConglomerateDescriptor for the conglomerate
tc - TransactionController for the transaction
Throws:
StandardException - Thrown on failure

dropAllConglomerateDescriptors

public void dropAllConglomerateDescriptors(TableDescriptor td,
                                           TransactionController tc)
                                    throws StandardException
Drops all conglomerates associated with a table.

Parameters:
tc - TransactionController for the transaction
Throws:
StandardException - Thrown on failure

updateConglomerateDescriptor

public void updateConglomerateDescriptor(ConglomerateDescriptor[] cds,
                                         long conglomerateNumber,
                                         TransactionController tc)
                                  throws StandardException
Update the conglomerateNumber for an array of ConglomerateDescriptors. In case of more than one ConglomerateDescriptor, they are for duplicate indexes sharing one conglomerate. This is useful, in 1.3, when doing a bulkInsert into an empty table where we insert into a new conglomerate. (This will go away in 1.4.)

Parameters:
cds - The array of ConglomerateDescriptors
conglomerateNumber - The new conglomerate number
tc - The TransactionController to use
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

updateConglomerateDescriptor

public void updateConglomerateDescriptor(ConglomerateDescriptor cd,
                                         long conglomerateNumber,
                                         TransactionController tc)
                                  throws StandardException
Update the conglomerateNumber for a ConglomerateDescriptor. This is useful, in 1.3, when doing a bulkInsert into an empty table where we insert into a new conglomerate. (This will go away in 1.4.)

Parameters:
cd - The ConglomerateDescriptor
conglomerateNumber - The new conglomerate number
tc - The TransactionController to use
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

getDependentsDescriptorList

public java.util.List getDependentsDescriptorList(java.lang.String dependentID)
                                           throws StandardException
Gets a list of the dependency descriptors for the given dependent's id.

Parameters:
dependentID - The ID of the dependent we're interested in
Returns:
List Returns a list of DependencyDescriptors. Returns an empty list if no stored dependencies for the dependent's ID.
Throws:
StandardException - Thrown on failure

getProvidersDescriptorList

public java.util.List getProvidersDescriptorList(java.lang.String providerID)
                                          throws StandardException
Gets a list of the dependency descriptors for the given provider's id.

Returns:
List Returns a list of DependencyDescriptors. Returns an empty List if no stored dependencies for the provider's ID.
Throws:
StandardException - Thrown on failure

getAllDependencyDescriptorsList

public java.util.List getAllDependencyDescriptorsList()
                                               throws StandardException
Build and return an List with DependencyDescriptors for all of the stored dependencies. This is useful for consistency checking.

Returns:
List List of all DependencyDescriptors.
Throws:
StandardException - Thrown on failure

dropStoredDependency

public void dropStoredDependency(DependencyDescriptor dd,
                                 TransactionController tc)
                          throws StandardException
Drop a dependency from the data dictionary.

Parameters:
dd - The DependencyDescriptor.
tc - TransactionController for the transaction
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

dropDependentsStoredDependencies

public void dropDependentsStoredDependencies(UUID dependentsUUID,
                                             TransactionController tc)
                                      throws StandardException
Remove all of the stored dependencies for a given dependent's ID from the data dictionary.

Parameters:
dependentsUUID - Dependent's uuid
tc - TransactionController for the transaction
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

getUUIDFactory

public UUIDFactory getUUIDFactory()
Get the UUID Factory. (No need to make the UUIDFactory a module.)

Returns:
UUIDFactory The UUID Factory for this DataDictionary.

getAliasDescriptor

public AliasDescriptor getAliasDescriptor(UUID uuid)
                                   throws StandardException
Get an AliasDescriptor given its UUID.

Parameters:
uuid - The UUID
Returns:
The AliasDescriptor for method alias.
Throws:
StandardException - Thrown on failure

getAliasDescriptor

public AliasDescriptor getAliasDescriptor(java.lang.String schemaID,
                                          java.lang.String aliasName,
                                          char nameSpace)
                                   throws StandardException
Get a AliasDescriptor by alias name and name space. NOTE: caller responsible for handling no match.

Parameters:
aliasName - The alias name.
nameSpace - The alias name space.
Returns:
AliasDescriptor AliasDescriptor for the alias name and name space
Throws:
StandardException - Thrown on failure

getRoutineList

public java.util.List getRoutineList(java.lang.String schemaID,
                                     java.lang.String routineName,
                                     char nameSpace)
                              throws StandardException
Get the list of routines matching the schema and routine name.

Throws:
StandardException

dropAliasDescriptor

public void dropAliasDescriptor(AliasDescriptor ad,
                                TransactionController tc)
                         throws StandardException
Drop an AliasDescriptor from the DataDictionary

Parameters:
ad - The AliasDescriptor to drop
tc - The TransactionController
Returns:
Nothing.
Throws:
StandardException - Thrown on failure

getCoreCatalog

public TabInfo getCoreCatalog(int coreNum)
                       throws StandardException
Get core catalog info.

Parameters:
coreNum - The index into coreInfo[].
Returns:
Nothing.
Throws:
StandardException - Thrown on error

getEngineType

public int getEngineType()

getFileInfoDescriptor

public FileInfoDescriptor getFileInfoDescriptor(UUID id)
                                         throws StandardException
Get a FileInfoDescriptor given its id.

Parameters:
id - The descriptor's id.
Throws:
StandardException - Thrown on failure

getFileInfoDescriptor

public FileInfoDescriptor getFileInfoDescriptor(SchemaDescriptor sd,
                                                java.lang.String name)
                                         throws StandardException
Get a FileInfoDescriptor given its SQL name and schema name.

Parameters:
sd - the schema that holds the FileInfoDescriptor.
Throws:
StandardException - Thrown on failure

dropFileInfoDescriptor

public void dropFileInfoDescriptor(FileInfoDescriptor fid)
                            throws StandardException
Drop a FileDescriptor from the datadictionary.

Throws:
StandardException - Oops

computeAutoincRowLocations

public RowLocation[] computeAutoincRowLocations(TransactionController tc,
                                                TableDescriptor td)
                                         throws StandardException
returns an array of RowLocations corresponding to the autoincrement columns in the table. The RowLocation points to the row in SYSCOLUMNS for this particular ai column. The array has as many elements as there are columns in the table. If a column is not an ai column, the entry is NULL.

Parameters:
tc - TransactionControler to use to compute the row location.
td - TableDescriptor
Returns:
array of row locations, null if table has no autoinc columns.
Throws:
standard - exception on error.
StandardException

getRowLocationTemplate

public RowLocation getRowLocationTemplate(LanguageConnectionContext lcc,
                                          TableDescriptor td)
                                   throws StandardException
Throws:
StandardException

getSetAutoincrementValue

public NumberDataValue getSetAutoincrementValue(RowLocation rl,
                                                TransactionController tc,
                                                boolean doUpdate,
                                                NumberDataValue newValue,
                                                boolean wait)
                                         throws StandardException
getSetAutoincrementValue fetches the autoincrement value from SYSCOLUMNS given a row location. If doUpdate is true it updates the autoincrement column with the new value. the value returned by this routine is the new value and *NOT* the value in the system catalogs.

Parameters:
rl - RowLocation of the entry in SYSCOLUMNS.
tc - TransactionController to use.
doUpdate - Write the new value to disk if TRUE.
newValue - A NumberDataValue to use to return incremented value. If null, then the caller simply wants the current value fromd disk.
wait - If true, then the caller wants to wait for locks. When using a nested user xaction we want to timeout right away if the parent holds the lock.
Throws:
StandardException

setAutoincrementValue

public void setAutoincrementValue(TransactionController tc,
                                  UUID tableUUID,
                                  java.lang.String columnName,
                                  long aiValue,
                                  boolean incrementNeeded)
                           throws StandardException
sets a new value in SYSCOLUMNS for a particular autoincrement column.

Parameters:
tc - Transaction Controller to use.
columnName - Name of the column.
aiValue - Value to write to SYSCOLUMNS.
incrementNeeded - Whether we should increment the value passed in by the user (aiValue) before writing the value to SYSCOLUMNS.
Throws:
StandardException

getStatisticsDescriptors

public java.util.List getStatisticsDescriptors(TableDescriptor td)
                                        throws StandardException
Gets all statistics Descriptors for a given table.

Throws:
StandardException

dropStatisticsDescriptors

public void dropStatisticsDescriptors(UUID tableUUID,
                                      UUID referenceUUID,
                                      TransactionController tc)
                               throws StandardException
Drops all statistics descriptors for a given table/index column combination. If the index is not specified, then all statistics for the table are dropped.

Parameters:
tableUUID - UUID of the table
referenceUUID - UUID of the index. This can be null.
tc - Transcation Controller to use.
Throws:
StandardException

getDependencyManager

public DependencyManager getDependencyManager()
Returns the dependency manager for this DataDictionary. Associated with each DataDictionary object there is a DependencyManager object which keeps track of both persistent and stored dependencies.

See Also:
DependencyManager

getCacheMode

public int getCacheMode()
Returns the cache mode of the data dictionary.


getSystemSQLName

public java.lang.String getSystemSQLName()
Returns a unique system generated name of the form SQLyymmddhhmmssxxn yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second, xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value, n - number between 0-9

Returns:
system generated unique name

addDescriptor

public void addDescriptor(TupleDescriptor tuple,
                          TupleDescriptor parent,
                          int catalogNumber,
                          boolean allowsDuplicates,
                          TransactionController tc)
                   throws StandardException
Adds a descriptor to a system catalog identified by the catalogNumber.

Parameters:
tuple - descriptor to insert.
parent - parent descriptor; e.g for a column parent is the tabledescriptor to which the descriptor is beign inserted. for most other objects it is the schema descriptor.
catalogNumber - a value which identifies the catalog into which the descriptor should be inserted. It is the users responsibility to ensure that the catalogNumber is consistent with the tuple being inserted.
allowsDuplicates - whether an exception should be thrown if the insert results in a duplicate; if this parameter is FALSE then one of the following exception will be thrown; LANG_OBJECT_ALREADY_EXISTS (if parent is null) or LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT (if parent is not null). The error message is created by getting the name and type of the tuple and parent.
tc - the transaction controller to use to do all of this.
Throws:
StandardException
See Also:
SYSCONGLOMERATES_CATALOG_NUM, DataDictionaryImpl.duplicateDescriptorException(org.apache.derby.iapi.sql.dictionary.TupleDescriptor, org.apache.derby.iapi.sql.dictionary.TupleDescriptor), addDescriptorArray(org.apache.derby.iapi.sql.dictionary.TupleDescriptor[], org.apache.derby.iapi.sql.dictionary.TupleDescriptor, int, boolean, org.apache.derby.iapi.store.access.TransactionController)

addDescriptorArray

public void addDescriptorArray(TupleDescriptor[] tuple,
                               TupleDescriptor parent,
                               int catalogNumber,
                               boolean allowsDuplicates,
                               TransactionController tc)
                        throws StandardException
array version of addDescriptor.

Throws:
StandardException
See Also:
addDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor, org.apache.derby.iapi.sql.dictionary.TupleDescriptor, int, boolean, org.apache.derby.iapi.store.access.TransactionController)

checkVersion

public boolean checkVersion(int majorVersion,
                            java.lang.String feature)
                     throws StandardException
Check to see if a database has been upgraded to the required level in order to use a langauge feature that is.

Parameters:
majorVersion - Data Dictionary major version
feature - Non-null to throw an error, null to return the state of the version match.
Returns:
True if the database has been upgraded to the required level, false otherwise.
Throws:
StandardException


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.