Interface DataDictionary
- All Known Implementing Classes:
DataDictionaryImpl
- Version:
- 0.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeDescriptor
An immutable catalog type that describes the type VARCHAR(128) NOT NULL with collation type UCS_BASIC.static final int
static final int
Modes returned from startReading()static final String
DataDictionaryVersion property indicates the updgrade level of the system catalogs.static final String
CreateDataDictionaryVersion property indicates the level of the system catalogs, at the time of database creation.static final String
static final int
Cloudscape/Derby 10.0 (Gandalf) System Catalog versionstatic final int
Cloudscape 5.0 System Catalog versionstatic final int
Cloudscape 5.1 (Arwen) System Catalog versionstatic final int
Cloudscape 5.2 (Frodo) System Catalog versionstatic final int
Cloudscape 8.1 (Pre-Gandalf) System Catalog versionstatic final int
Special version indicating the database must be upgraded to or created at the current engine level DatabaseMetaData will use this to determine if the data dictionary is at the latest System Catalog version number.static final int
Derby 10.1 System Catalog versionstatic final int
Derby 10.10 System Catalog versionstatic final int
Derby 10.11 System Catalog versionstatic final int
Derby 10.12 System Catalog versionstatic final int
Derby 10.13 System Catalog versionstatic final int
Derby 10.14 System Catalog versionstatic final int
Derby 10.2 System Catalog versionstatic final int
Derby 10.3 System Catalog versionstatic final int
Derby 10.4 System Catalog versionstatic final int
Derby 10.5 System Catalog versionstatic final int
Derby 10.6 System Catalog versionstatic final int
Derby 10.7 System Catalog versionstatic final int
Derby 10.8 System Catalog versionstatic final int
Derby 10.9 System Catalog versionstatic final int
static final int
static final int
static final int
static final String
static final int
static final int
static final String
static final String
derby.softDataDictionaryVersion property indicates the soft upgrade level of the system catalogs.static final int
static final int
static final int
static final int
static final int
static final int
Catalog numbers for non core system catalogs.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final DataTypeDescriptor
An immutable runtime type that describes the type VARCHAR(128) NOT NULL with collation type UCS_BASIC and derivation IMPLICIT.static final int
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.boolean
addRemovePermissionsDescriptor
(boolean add, PermissionsDescriptor perm, String grantee, TransactionController tc) Add or remove a permission to the permission database.void
addSPSDescriptor
(SPSDescriptor descriptor, TransactionController tc) Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.boolean
checkVersion
(int majorVersion, 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
Clear all of the DataDictionary caches.void
clearCaches
(boolean clearSequenceCaches) Clear the DataDictionary caches, including the sequence caches if requested..void
Clear all of the sequence number generators.returns an array of RowLocations corresponding to the autoincrement columns in the table.void
computeSequenceRowLocation
(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) Computes the RowLocation in SYSSEQUENCES for a particular sequence.void
createIndexStatsRefresher
(Database db, String databaseName) Creates an index statistics refresher for this data dictionary.createRoleClosureIterator
(TransactionController tc, String role, boolean inverse) This method creates a new iterator over the closure of role grants starting or ending with a given role.void
Disables automatic refresh/creation of index statistics at runtime.boolean
Tells if an index statistics refresher should be created for this database.void
doneReading
(int mode, LanguageConnectionContext lcc) Inform this DataDictionary that we have finished reading it.void
Drop an AliasDescriptor from the DataDictionaryvoid
dropAllColumnDescriptors
(UUID tableID, TransactionController tc) Drops all column descriptors from the given table.void
Drops all conglomerates associated with a table.void
Drops all ConstraintDescriptors from the data dictionary that are associated with the given table.void
dropAllPermDescriptors
(UUID objectID, TransactionController tc) Drops all permission descriptors for the given objectvoid
dropAllPermsByGrantee
(String authid, TransactionController tc) Drop all permission descriptors corresponding to a grant to the named authentication identifiervoid
dropAllRoutinePermDescriptors
(UUID routineID, TransactionController tc) Drops all routine permission descriptors for the given routine.void
dropAllTableAndColPermDescriptors
(UUID tableID, TransactionController tc) Drops all table and column permission descriptors for the given table.void
dropColumnDescriptor
(UUID tableID, 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 descriptorvoid
dropConstraintDescriptor
(ConstraintDescriptor descriptor, TransactionController tc) Drops the given ConstraintDescriptor 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
dropDependentsStoredDependencies
(UUID dependentsUUID, TransactionController tc, boolean wait) Remove all of the stored dependencies for a given dependent's ID from the data dictionary.void
Drop a FileDescriptor from the datadictionary.void
dropRoleGrant
(String roleName, String grantee, String grantor, TransactionController tc) Drop a role grantvoid
dropRoleGrantsByGrantee
(String grantee, TransactionController tc) Drop all role grants corresponding to a grant of (any) role to a named authentication identifiervoid
dropRoleGrantsByName
(String roleName, TransactionController tc) Drop all role grants corresponding to a grant of the named role to any authentication identifiervoid
dropSchemaDescriptor
(String schemaName, TransactionController tc) Drop the descriptor for a schema, given the schema's namevoid
dropSequenceDescriptor
(SequenceDescriptor sequenceDescriptor, TransactionController tc) Drop a sequence descriptor.void
dropSPSDescriptor
(UUID uuid, TransactionController tc) Drops the given SPSDescriptor.void
dropSPSDescriptor
(SPSDescriptor descriptor, 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
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
dropUser
(String userName, TransactionController tc) Drop a User from the DataDictionaryvoid
dropViewDescriptor
(ViewDescriptor viewDescriptor, TransactionController tc) Drops the view descriptor from the data dictionary.int[]
examineTriggerNodeAndCols
(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements) boolean
existsGrantToAuthid
(String authId, TransactionController tc) Check all dictionary tables and return true if there is any GRANT descriptor containingauthId
as its grantee.boolean
existsSchemaOwnedBy
(String authid, TransactionController tc) Return true of there exists a schema whose authorizationId equals authid, i.e.void
flushBulkInsertCounter
(String sequenceUUIDString, BulkInsertCounter bic) Flush the updated values of the BulkInsertCounter to disk and to the original, cached SequenceUpdater.Convert a constraint descriptor list into a list of active constraints, that is, constraints which must be enforced.getAliasDescriptor
(String schemaID, String aliasName, char nameSpace) Get a AliasDescriptor by alias name and name space.getAliasDescriptor
(UUID uuid) Get an AliasDescriptor given its UUID.Get the alias descriptor for an ANSI UDT.Build and return an List with DependencyDescriptors for all of the stored dependencies.Get every statement in this database.Get authorizationID of Database OwnergetBuiltinVTIClass
(TableDescriptor td, boolean asTableFunction) Return the Java class to use for a builtin VTI to which the received table descriptor maps.getBulkInsertCounter
(String sequenceUUIDString, boolean restart) Get the identity generator used to support the bulk-insert optimization in InsertResultSet.int
Returns the cache mode of the data dictionary.int
Return the collation type for SYSTEM schemas.int
Return the collation type for user schemas.getColumnDependableFinder
(int formatId, byte[] columnBitMap) Get aDependableFinder
instance for referenced columns in a table.Get a ColumnDescriptor given its Default ID.getColumnPermissions
(UUID colPermsUUID) Get one user's column privileges on a table using colPermsUUIDgetColumnPermissions
(UUID tableUUID, int privType, boolean forGrant, String authorizationId) Get one user's column privileges for a table.getColumnPermissions
(UUID tableUUID, String privTypeStr, boolean forGrant, String authorizationId) Get one user's column privileges for a table.getConglomerateDescriptor
(long conglomerateNumber) Get a ConglomerateDescriptor given its conglomerate number.getConglomerateDescriptor
(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.Get a ConglomerateDescriptor given its UUID.getConglomerateDescriptors
(long conglomerateNumber) Get an array of conglomerate descriptors for the given conglomerate number.Get an array of ConglomerateDescriptors given the UUID.getConstraintDescriptor
(String constraintName, UUID schemaID) Get a ConstraintDescriptor given its name and schema ID.getConstraintDescriptor
(UUID uuid) Get a ConstraintDescriptor given its UUID.getConstraintDescriptor
(TableDescriptor td, UUID uuid) Get the constraint descriptor given a table and the UUID String of the backing index.getConstraintDescriptorById
(TableDescriptor td, UUID uuid) Get the constraint descriptor given a table and the UUID String of the constraintgetConstraintDescriptorByName
(TableDescriptor td, SchemaDescriptor sd, String constraintName, boolean forUpdate) Get the constraint descriptor given a TableDescriptor and the constraint name.Load up the constraint descriptor list for this table descriptor (or all) and return it.getConstraintTableDescriptor
(UUID constraintId) Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passed in.void
getCurrentValueAndAdvance
(String sequenceUUIDstring, NumberDataValue returnValue) Get the next number from an ANSI/ISO sequence generator which was created with the CREATE SEQUENCE statement.Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.Get the DataValueFactory associated with this database.Get the descriptor for the declared global temporary table schema which is always named "SESSION".getDependableFinder
(int formatId) Get aDependableFinder
instance.Returns the dependency manager for this DataDictionary.getDependentsDescriptorList
(String dependentID) Gets a list of the dependency descriptors for the given dependent's id.int
Get the ExecutionFactory associated with this database.Get a FileInfoDescriptor given its id.getFileInfoDescriptor
(SchemaDescriptor sd, String name) Get a FileInfoDescriptor given its SQL name and schema name.getForeignKeys
(UUID constraintId) Return a list of foreign keys constraints referencing this constraint.getGenericPermissions
(UUID permUUID) Get one user's privileges for an object using the permUUIDgetGenericPermissions
(UUID objectUUID, String objectType, String privilege, String granteeAuthId) Get permissions granted to one user for an object using the object's Id and the user's authorization Id.getIndexStatsRefresher
(boolean asDaemon) Returns the index statistics refresher.getProvidersDescriptorList
(String providerID) Gets a list of the dependency descriptors for the given provider's id.getRoleDefinitionDescriptor
(String roleName) Get a role grant descriptor for a role definition.getRoleGrantDescriptor
(String roleName, String grantee, String grantor) Get a descriptor for a role grantgetRoleGrantDescriptor
(UUID uuid) Get the role grant descriptor corresponding to the uuid providedgetRoutineList
(String schemaID, String routineName, char nameSpace) Get the list of routines matching the schema and routine name.getRoutinePermissions
(UUID routinePermsUUID) Get one user's privileges for a routine using routinePermsUUIDgetRoutinePermissions
(UUID routineUUID, String authorizationId) Get one user's permissions for a routine (function or procedure).getSchemaDescriptor
(String schemaName, TransactionController tc, boolean raiseError) Get the descriptor for the named schema.getSchemaDescriptor
(UUID schemaId, int isolationLevel, TransactionController tc) Get the SchemaDescriptor for the given schema identifier.getSchemaDescriptor
(UUID schemaId, TransactionController tc) Get the SchemaDescriptor for the given schema identifier.getSequenceDescriptor
(UUID uuid) get a descriptor for a Sequence by uuidgetSequenceDescriptor
(SchemaDescriptor sd, String sequenceName) get a descriptor for a Sequence by sequence namegetSetAutoincrementValue
(RowLocation rl, TransactionController tc, boolean doUpdate, NumberDataValue newValue, boolean wait) getSetAutoincrementValue fetches the autoincrement value from SYSCOLUMNS given a row location.getSPSDescriptor
(String name, SchemaDescriptor sd) Get the stored prepared statement descriptor given a sps name.getSPSDescriptor
(UUID uuid) Get a SPSDescriptor given its UUID.getSPSParams
(SPSDescriptor spsd, List<DataValueDescriptor> defaults) Get all the parameter descriptors for an SPS.Gets all statistics Descriptors for a given table.getSubKeyConstraint
(UUID constraintId, int type) Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for the specified constraint id.Get the descriptor for the SYSIBM schema.Get the descriptor for the system schema.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-9getTableDescriptor
(String tableName, SchemaDescriptor schema, TransactionController tc) Get the descriptor for the named table within the given schema.getTableDescriptor
(UUID tableID) Get the descriptor for the table with the given UUID.getTablePermissions
(UUID tablePermsUUID) Get one user's privileges on a table using tablePermsUUIDgetTablePermissions
(UUID tableUUID, String authorizationId) Get one user's privileges on a table using tableUUID and authorizationidgetTriggerActionString
(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements, int[] cols) This method does the job of transforming the trigger action plan text as shown below.getTriggerDescriptor
(String name, SchemaDescriptor sd) Get the stored prepared statement descriptor given a sps name.getTriggerDescriptor
(UUID uuid) Get a TriggerDescriptor given its UUID.Load up the trigger descriptor list for this table descriptor and return it.Return the credentials descriptor for the named user.Get the UUID Factory.getViewDescriptor
(UUID uuid) Gets the viewDescriptor for the view with the given UUID.Gets the viewDescriptor for the view given its TableDescriptor.getVTIClass
(TableDescriptor td, boolean asTableFunction) Return the Java class to use for the VTI to which the received table descriptor maps.Get all of the ConglomerateDescriptors in the database and hash them by conglomerate number.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
Invalidate all the stored plans in SYS.SYSSTATEMENTS.void
Invalidate all the stored plans in SYS.SYSSTATEMENTS for the given language connection context.boolean
Check if the database is read only and requires some form of upgrade that makes the stored prepared statements invalid.boolean
Indicate whether there is anything in the particular schema.boolean
isSystemSchemaName
(String name) Determine whether a string is the name of the system schema.makePasswordHasher
(Dictionary<?, ?> props) Get the default password hasher for this database level.peekAtIdentity
(String schemaName, String tableName) Peek at the next value which will be returned by an identity generator.peekAtSequence
(String schemaName, String sequenceName) Peek at the next value which will be returned by a sequence generator.void
setAutoincrementValue
(TransactionController tc, UUID tableUUID, String columnName, long aiValue, boolean incrementNeeded) sets a new value in SYSCOLUMNS for a particular autoincrement column.int
Inform this DataDictionary that we are about to start reading it.void
Inform this DataDictionary that we are about to start writing to it.void
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.boolean
updateCurrentSequenceValue
(TransactionController tc, RowLocation rowLocation, boolean wait, Long oldValue, Long newValue) Set the current value of an ANSI/ISO sequence.void
updateLockGranularity
(TableDescriptor td, SchemaDescriptor schema, char lockGranularity, TransactionController tc) Update the lockGranularity for the specified table.void
Drop and recreate metadata stored prepared statements.void
updateSPS
(SPSDescriptor spsd, TransactionController tc, boolean recompile) Updates SYS.SYSSTATEMENTS with the info from the SPSD.void
Need to update SYSCOLPERMS for a given table because a new column has been added to that table.void
updateSYSCOLPERMSforDropColumn
(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor) Update SYSCOLPERMS to reflect the dropping of a column from a table.void
updateTriggerDescriptor
(TriggerDescriptor triggerd, UUID formerUUID, int[] colsToSet, TransactionController tc) Update the trigger descriptor in question.void
updateUser
(UserDescriptor newDescriptor, TransactionController tc) Update a user.boolean
Get authorization model in force, SqlStandard or legacy mode
-
Field Details
-
MODULE
- See Also:
-
DD_VERSION_CURRENT
static final int DD_VERSION_CURRENTSpecial version indicating the database must be upgraded to or created at the current engine level DatabaseMetaData will use this to determine if the data dictionary is at the latest System Catalog version number. A data dictionary version will not be at latest System Catalog version when the database is getting booted in soft upgrade mode. In soft upgrade mode, engine should goto metadata.properties to get the sql for the metadata calls rather than going to the system tables (and using stored versions of these queries). This is required because if the metadata sql has changed between the releases, we want to use the latest metadata sql rather than what is stored in the system catalogs. Had to introduce this behavior for EmbeddedDatabaseMetaData in 10.2 release where optimizer overrides syntax was changed. If 10.2 engine in soft upgrade mode for a pre-10.2 database went to system tables for stored metadata queires, the metadata calls would fail because 10.2 release doesn't recognize the pre-10.2 optimizer overrides syntax. To get around this, the 10.2 engine in soft upgrade mode should get the sql from metata.properties which has been changed to 10.2 syntax for optimizer overrides. To make this approach more generic for all soft upgrades, from 10.2 release onwards, DatabaseMetaData calls will always look at metadata.properties so it will get the compatible syntax for that release.- See Also:
-
DD_VERSION_CS_5_0
static final int DD_VERSION_CS_5_0Cloudscape 5.0 System Catalog version- See Also:
-
DD_VERSION_CS_5_1
static final int DD_VERSION_CS_5_1Cloudscape 5.1 (Arwen) System Catalog version- See Also:
-
DD_VERSION_CS_5_2
static final int DD_VERSION_CS_5_2Cloudscape 5.2 (Frodo) System Catalog version- See Also:
-
DD_VERSION_CS_8_1
static final int DD_VERSION_CS_8_1Cloudscape 8.1 (Pre-Gandalf) System Catalog version- See Also:
-
DD_VERSION_CS_10_0
static final int DD_VERSION_CS_10_0Cloudscape/Derby 10.0 (Gandalf) System Catalog version- See Also:
-
DD_VERSION_DERBY_10_1
static final int DD_VERSION_DERBY_10_1Derby 10.1 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_2
static final int DD_VERSION_DERBY_10_2Derby 10.2 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_3
static final int DD_VERSION_DERBY_10_3Derby 10.3 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_4
static final int DD_VERSION_DERBY_10_4Derby 10.4 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_5
static final int DD_VERSION_DERBY_10_5Derby 10.5 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_6
static final int DD_VERSION_DERBY_10_6Derby 10.6 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_7
static final int DD_VERSION_DERBY_10_7Derby 10.7 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_8
static final int DD_VERSION_DERBY_10_8Derby 10.8 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_9
static final int DD_VERSION_DERBY_10_9Derby 10.9 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_10
static final int DD_VERSION_DERBY_10_10Derby 10.10 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_11
static final int DD_VERSION_DERBY_10_11Derby 10.11 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_12
static final int DD_VERSION_DERBY_10_12Derby 10.12 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_13
static final int DD_VERSION_DERBY_10_13Derby 10.13 System Catalog version- See Also:
-
DD_VERSION_DERBY_10_14
static final int DD_VERSION_DERBY_10_14Derby 10.14 System Catalog version- See Also:
-
DATABASE_ID
- See Also:
-
CORE_DATA_DICTIONARY_VERSION
DataDictionaryVersion property indicates the updgrade level of the system catalogs. Stored as a database property. Set to an instance of DD_Version with the major number one of the DataDictionary.DD_* values.- See Also:
-
CREATE_DATA_DICTIONARY_VERSION
CreateDataDictionaryVersion property indicates the level of the system catalogs, at the time of database creation. Stored as a database property. Set to an instance of DD_Version.- See Also:
-
SOFT_DATA_DICTIONARY_VERSION
derby.softDataDictionaryVersion property indicates the soft upgrade level of the system catalogs. Soft upgrade will sometime make minor changes to the system catalogs that can be safely consumed by earlier versions, such as correcting values. Stored as a database property. Set to an instance of DD_Version.- See Also:
-
PROPERTY_CONGLOMERATE_VERSION
- See Also:
-
TYPE_SYSTEM_IDENTIFIER
An immutable runtime type that describes the type VARCHAR(128) NOT NULL with collation type UCS_BASIC and derivation IMPLICIT. -
CATALOG_TYPE_SYSTEM_IDENTIFIER
An immutable catalog type that describes the type VARCHAR(128) NOT NULL with collation type UCS_BASIC. -
SYSCONGLOMERATES_CATALOG_NUM
static final int SYSCONGLOMERATES_CATALOG_NUM- See Also:
-
SYSTABLES_CATALOG_NUM
static final int SYSTABLES_CATALOG_NUM- See Also:
-
SYSCOLUMNS_CATALOG_NUM
static final int SYSCOLUMNS_CATALOG_NUM- See Also:
-
SYSSCHEMAS_CATALOG_NUM
static final int SYSSCHEMAS_CATALOG_NUM- See Also:
-
SYSCONSTRAINTS_CATALOG_NUM
static final int SYSCONSTRAINTS_CATALOG_NUMCatalog numbers for non core system catalogs.- See Also:
-
SYSKEYS_CATALOG_NUM
static final int SYSKEYS_CATALOG_NUM- See Also:
-
SYSDEPENDS_CATALOG_NUM
static final int SYSDEPENDS_CATALOG_NUM- See Also:
-
SYSALIASES_CATALOG_NUM
static final int SYSALIASES_CATALOG_NUM- See Also:
-
SYSVIEWS_CATALOG_NUM
static final int SYSVIEWS_CATALOG_NUM- See Also:
-
SYSCHECKS_CATALOG_NUM
static final int SYSCHECKS_CATALOG_NUM- See Also:
-
SYSFOREIGNKEYS_CATALOG_NUM
static final int SYSFOREIGNKEYS_CATALOG_NUM- See Also:
-
SYSSTATEMENTS_CATALOG_NUM
static final int SYSSTATEMENTS_CATALOG_NUM- See Also:
-
SYSFILES_CATALOG_NUM
static final int SYSFILES_CATALOG_NUM- See Also:
-
SYSTRIGGERS_CATALOG_NUM
static final int SYSTRIGGERS_CATALOG_NUM- See Also:
-
SYSSTATISTICS_CATALOG_NUM
static final int SYSSTATISTICS_CATALOG_NUM- See Also:
-
SYSDUMMY1_CATALOG_NUM
static final int SYSDUMMY1_CATALOG_NUM- See Also:
-
SYSTABLEPERMS_CATALOG_NUM
static final int SYSTABLEPERMS_CATALOG_NUM- See Also:
-
SYSCOLPERMS_CATALOG_NUM
static final int SYSCOLPERMS_CATALOG_NUM- See Also:
-
SYSROUTINEPERMS_CATALOG_NUM
static final int SYSROUTINEPERMS_CATALOG_NUM- See Also:
-
SYSROLES_CATALOG_NUM
static final int SYSROLES_CATALOG_NUM- See Also:
-
SYSSEQUENCES_CATALOG_NUM
static final int SYSSEQUENCES_CATALOG_NUM- See Also:
-
SYSPERMS_CATALOG_NUM
static final int SYSPERMS_CATALOG_NUM- See Also:
-
SYSUSERS_CATALOG_NUM
static final int SYSUSERS_CATALOG_NUM- See Also:
-
NOTNULL_CONSTRAINT
static final int NOTNULL_CONSTRAINT- See Also:
-
PRIMARYKEY_CONSTRAINT
static final int PRIMARYKEY_CONSTRAINT- See Also:
-
UNIQUE_CONSTRAINT
static final int UNIQUE_CONSTRAINT- See Also:
-
CHECK_CONSTRAINT
static final int CHECK_CONSTRAINT- See Also:
-
DROP_CONSTRAINT
static final int DROP_CONSTRAINT- See Also:
-
FOREIGNKEY_CONSTRAINT
static final int FOREIGNKEY_CONSTRAINT- See Also:
-
MODIFY_CONSTRAINT
static final int MODIFY_CONSTRAINT- See Also:
-
COMPILE_ONLY_MODE
static final int COMPILE_ONLY_MODEModes returned from startReading()- See Also:
-
DDL_MODE
static final int DDL_MODE- See Also:
-
-
Method Details
-
clearCaches
Clear the DataDictionary caches, including the sequence caches if requested..- Throws:
StandardException
- Standard Derby error policy
-
clearCaches
Clear all of the DataDictionary caches.- Throws:
StandardException
- Standard Derby error policy
-
clearSequenceCaches
Clear all of the sequence number generators.- Throws:
StandardException
- Standard Derby error policy
-
startReading
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
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
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
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
ExecutionFactory getExecutionFactory()Get the ExecutionFactory associated with this database.- Returns:
- The ExecutionFactory
-
getDataValueFactory
DataValueFactory getDataValueFactory()Get the DataValueFactory associated with this database.- Returns:
- The ExecutionFactory
-
getDataDescriptorGenerator
DataDescriptorGenerator getDataDescriptorGenerator()Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.- Returns:
- A DataDescriptorGenerator
-
getAuthorizationDatabaseOwner
String getAuthorizationDatabaseOwner()Get authorizationID of Database Owner- Returns:
- authorizationID
-
usesSqlAuthorization
boolean usesSqlAuthorization()Get authorization model in force, SqlStandard or legacy mode- Returns:
- Whether sqlAuthorization is being used
-
getCollationTypeOfSystemSchemas
int getCollationTypeOfSystemSchemas()Return the collation type for SYSTEM schemas. In Derby 10.3, this will always be UCS_BASIC- Returns:
- the collation type for SYSTEM schemas
-
getCollationTypeOfUserSchemas
int getCollationTypeOfUserSchemas()Return the collation type for user schemas. In Derby 10.3, this is either UCS_BASIC or TERRITORY_BASED. The exact value is decided by what has user asked for through JDBC url optional attribute COLLATION. If that atrribute is set to UCS_BASIC, the collation type for user schemas will be UCS_BASIC. If that attribute is set to TERRITORY_BASED, the collation type for user schemas will be TERRITORY_BASED. If the user has not provided COLLATION attribute value in the JDBC url at database create time, then collation type of user schemas will default to UCS_BASIC. Pre-10.3 databases after upgrade to Derby 10.3 will also use UCS_BASIC for collation type of user schemas.- Returns:
- the collation type for user schemas
-
getSchemaDescriptor
SchemaDescriptor getSchemaDescriptor(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
- TransactionControllerraiseError
- 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
SchemaDescriptor getSchemaDescriptor(UUID schemaId, TransactionController tc) throws StandardException Get the SchemaDescriptor for the given schema identifier.- Parameters:
schemaId
- The id of the schema we're interested in.tc
- The transaction controller to us when scanning SYSSCHEMAS- Returns:
- The descriptor for the schema, null if no such schema exists.
- Throws:
StandardException
- Thrown on failure
-
getSchemaDescriptor
SchemaDescriptor getSchemaDescriptor(UUID schemaId, int isolationLevel, TransactionController tc) throws StandardException Get the SchemaDescriptor for the given schema identifier.- Parameters:
schemaId
- The id of the schema we're interested in.isolationLevel
- use this explicit isolation leveltc
- The transaction controller to us when scanning SYSSCHEMAS- Returns:
- The descriptor for the schema, null if no such schema exists.
- Throws:
StandardException
- Thrown on failure
-
existsSchemaOwnedBy
Return true of there exists a schema whose authorizationId equals authid, i.e. SYSSCHEMAS contains a row whose column AUTHORIZATIONID equals authid.- Parameters:
authid
- authorizationIdtc
- TransactionController- Returns:
- true iff there is a matching schema
- Throws:
StandardException
-
makePasswordHasher
Get the default password hasher for this database level. Returns null if the system is at rev level 10.5 or earlier.- Parameters:
props
- The persistent properties used to configure password hashing.- Throws:
StandardException
-
getSystemSchemaDescriptor
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
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
-
getDeclaredGlobalTemporaryTablesSchemaDescriptor
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
Determine whether a string is the name of the system schema.- Parameters:
name
-- Returns:
- true or false
- Throws:
StandardException
- Thrown on failure
-
dropRoleGrant
void dropRoleGrant(String roleName, String grantee, String grantor, TransactionController tc) throws StandardException Drop a role grant- Parameters:
roleName
- The name of the role to dropgrantee
- The granteegrantor
- The grantortc
- Transaction Controller- Throws:
StandardException
- Thrown on failure
-
dropRoleGrantsByGrantee
Drop all role grants corresponding to a grant of (any) role to a named authentication identifier- Parameters:
grantee
- The granteetc
- Transaction Controller- Throws:
StandardException
- Thrown on failure
-
dropRoleGrantsByName
Drop all role grants corresponding to a grant of the named role to any authentication identifier- Parameters:
roleName
- The role name grantedtc
- Transaction Controller- Throws:
StandardException
- Thrown on failure
-
createRoleClosureIterator
RoleClosureIterator createRoleClosureIterator(TransactionController tc, String role, boolean inverse) throws StandardException This method creates a new iterator over the closure of role grants starting or ending with a given role. This method will cause reading of dictionary, so should be called inside a transaction, after add.startReading()
ordd.startWriting()
call.- Parameters:
tc
- transaction controllerrole
- name of starting point for closureinverse
- Iftrue
, compute closure on inverse of relation GRANT role-a TO role-b that is, we look at closure of all roles grantedto role
. Iffalse
, we look at closure of all roles that have been grantedrole
.- Throws:
StandardException
-
dropAllPermsByGrantee
Drop all permission descriptors corresponding to a grant to the named authentication identifier- Parameters:
authid
- The authentication identifiertc
- Transaction Controller- Throws:
StandardException
- Thrown on failure
-
dropSchemaDescriptor
Drop the descriptor for a schema, given the schema's name- Parameters:
schemaName
- The name of the schema to droptc
- Transaction Controller- Throws:
StandardException
- Thrown on failure
-
isSchemaEmpty
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.- Parameters:
sd
- schema descriptor- Returns:
- true/false
- Throws:
StandardException
- on error
-
getTableDescriptor
TableDescriptor getTableDescriptor(String tableName, SchemaDescriptor schema, TransactionController tc) 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 forschema
- The descriptor for the schema the table lives in. If null, use the current (default) schema.tc
- Transaction context.- Returns:
- The descriptor for the table, null if table does not existe.
- Throws:
StandardException
- Thrown on failure
-
getTableDescriptor
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
void dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema, TransactionController tc) throws StandardException Drop the table descriptor.- Parameters:
td
- The table descriptor to dropschema
- 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) schematc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on error
-
updateLockGranularity
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 tableschema
- The SchemaDescriptor for the tablelockGranularity
- The new lockGranularitytc
- The TransactionController to use.- Throws:
StandardException
- Thrown on error
-
getColumnDescriptorByDefaultId
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
void dropColumnDescriptor(UUID tableID, 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 fromcolumnName
- The name of the column to droptc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
dropAllColumnDescriptors
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 descriptorstc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
dropAllTableAndColPermDescriptors
void dropAllTableAndColPermDescriptors(UUID tableID, TransactionController tc) throws StandardException Drops all table and column permission descriptors for the given table.- Parameters:
tableID
- The UUID of the table for which to drop all the table and column permission descriptorstc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
updateSYSCOLPERMSforAddColumnToUserTable
void updateSYSCOLPERMSforAddColumnToUserTable(UUID tableID, TransactionController tc) throws StandardException Need to update SYSCOLPERMS for a given table because a new column has been added to that table. SYSCOLPERMS has a column called "COLUMNS" which is a bit map for all the columns in a given user table. Since ALTER TABLE .. ADD COLUMN .. has added one more column, we need to expand "COLUMNS" for that new column Currently, this code gets called during execution phase of ALTER TABLE .. ADD COLUMN ..- Parameters:
tableID
- The UUID of the table to which a column has been addedtc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on error
-
updateSYSCOLPERMSforDropColumn
void updateSYSCOLPERMSforDropColumn(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor) throws StandardException Update SYSCOLPERMS to reflect the dropping of a column from a table. This method rewrites SYSCOLPERMS rows to update the COLUMNS bitmap to reflect the removal of a column from a table. Currently, this code gets called during execution phase of ALTER TABLE .. DROP COLUMN ..- Parameters:
tableID
- The UUID of the table whose column has been droppedtc
- TransactionController for the transactioncolumnDescriptor
- Info about the dropped column- Throws:
StandardException
- Thrown on error
-
dropAllRoutinePermDescriptors
void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc) throws StandardException Drops all routine permission descriptors for the given routine.- Parameters:
routineID
- The UUID of the routine for which to drop all the permission descriptorstc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
getViewDescriptor
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
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
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 droppedtc
- TransactionController to use- Throws:
StandardException
- Thrown on failure
-
getConstraintDescriptor
Get a ConstraintDescriptor given its UUID.- Parameters:
uuid
- The UUID- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getConstraintDescriptor
ConstraintDescriptor getConstraintDescriptor(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
Load up the constraint descriptor list for this table descriptor (or all) and return it. If the descriptor list is already loaded up, it is returned without further ado.- Parameters:
td
- The table descriptor.- Returns:
- The ConstraintDescriptorList for the table. If null, return a list of all the constraint descriptors in all schemas.
- Throws:
StandardException
- Thrown on failure
-
getActiveConstraintDescriptors
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
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
ConstraintDescriptor getConstraintDescriptor(TableDescriptor td, UUID uuid) throws StandardException Get the constraint descriptor given a table and the UUID String of the backing index.- Parameters:
td
- The table descriptor.uuid
- The UUID for the backing index.- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getConstraintDescriptorById
ConstraintDescriptor getConstraintDescriptorById(TableDescriptor td, UUID uuid) throws StandardException Get the constraint descriptor given a table and the UUID String of the constraint- Parameters:
td
- The table descriptor.uuid
- The UUID for the constraint- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getConstraintDescriptorByName
ConstraintDescriptor getConstraintDescriptorByName(TableDescriptor td, SchemaDescriptor sd, String constraintName, boolean forUpdate) throws StandardException Get the constraint descriptor given a TableDescriptor and the constraint name.- Parameters:
td
- The table descriptor.sd
- The schema descriptor for the constraintconstraintName
- The constraint name.forUpdate
- Whether or not access is for update- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getConstraintTableDescriptor
Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passed in.- Parameters:
constraintId
- The id of the constraint- Returns:
- the corresponding table descriptor
- Throws:
StandardException
- Thrown on error
-
getForeignKeys
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
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 addtc
- The transaction controller- Throws:
StandardException
- Thrown on error
-
dropConstraintDescriptor
void dropConstraintDescriptor(ConstraintDescriptor descriptor, TransactionController tc) throws StandardException Drops the given ConstraintDescriptor from the data dictionary. NOTE: Caller is responsible for dropping any backing index- Parameters:
descriptor
- The descriptor to droptc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
dropAllConstraintDescriptors
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 descriptorstc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
updateConstraintDescriptor
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 ConstraintescriptorformerUUID
- 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- Throws:
StandardException
- Thrown on failure
-
getSubKeyConstraint
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
Get a SPSDescriptor given its UUID.- Parameters:
uuid
- The UUID- Returns:
- The SPSDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getSPSDescriptor
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
Get every statement in this database. Return the SPSDescriptors in an list.- Returns:
- the list of descriptors
- Throws:
StandardException
- Thrown on failure
-
getSPSParams
DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, List<DataValueDescriptor> 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 descriptordefaults
- 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
Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.- Parameters:
descriptor
- The descriptor to addtc
- The transaction controller- Throws:
StandardException
- Thrown on error
-
updateSPS
void updateSPS(SPSDescriptor spsd, TransactionController tc, boolean recompile) throws StandardException Updates SYS.SYSSTATEMENTS with the info from the SPSD.- Parameters:
spsd
- The descriptor to addtc
- The transaction controllerrecompile
- whether to recompile or invalidate- Throws:
StandardException
- Thrown on error
-
dropSPSDescriptor
Drops the given SPSDescriptor.- Parameters:
descriptor
- The descriptor to droptc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
dropSPSDescriptor
Drops the given SPSDescriptor.- Parameters:
uuid
- the statement uuidtc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
invalidateAllSPSPlans
Invalidate all the stored plans in SYS.SYSSTATEMENTS for the given language connection context.- Throws:
StandardException
- Thrown on error
-
invalidateAllSPSPlans
Invalidate all the stored plans in SYS.SYSSTATEMENTS.- Throws:
StandardException
- Thrown on error
-
getTriggerDescriptor
Get a TriggerDescriptor given its UUID.- Parameters:
uuid
- The UUID- Returns:
- The TriggerDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getTriggerDescriptor
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
-
examineTriggerNodeAndCols
int[] examineTriggerNodeAndCols(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements) throws StandardException - Throws:
StandardException
-
getTriggerActionString
String getTriggerActionString(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements, int[] cols) throws StandardException This method does the job of transforming the trigger action plan text as shown below. DELETE FROM t WHERE c = old.c turns into DELETE FROM t WHERE c = org.apache.derby.iapi.db.Factory:: getTriggerExecutionContext().getOldRow(). getInt(columnNumberFor'C'inRuntimeResultset); In addition to that, for CREATE TRIGGER time, it does the job of collecting the column positions of columns referenced in trigger action plan through REFERENCEs clause. This information will get saved in SYSTRIGGERS table by the caller in CREATE TRIGGER case. It gets called either 1)at the trigger creation time for row level triggers or 2)if the trigger got invalidated by some other sql earlier and the current sql needs that trigger to fire. For such a trigger firing case, this method will get called only if it is row level trigger with REFERENCES clause. This work was done as part of DERBY-4874. Before DERBY-4874, once the stored prepared statement for trigger action plan was generated, it was never updated ever again. But, one case where the trigger action plan needs to be regenerated is say when the column length is changed for a column which is REFERENCEd as old or new column value. eg of such a case would be say the Alter table has changed the length of a varchar column from varchar(30) to varchar(64) but the stored prepared statement associated with the trigger action plan continued to use varchar(30). To fix varchar(30) in stored prepared statement for trigger action sql to varchar(64), we need to regenerate the trigger action sql. This new trigger action sql will then get updated into SYSSTATEMENTS table. If we are here for case 1) above, then we will collect all column references in trigger action through new/old transition variables. Information about them will be saved in SYSTRIGGERS table DERBY-1482 (if we are dealing with pre-10.7 db, then we will not put any information about trigger action columns in the system table to ensure backward compatibility). This information along with the trigger columns will decide what columns from the trigger table will be fetched into memory during trigger execution. If we are here for case 2) above, then all the information about column references in trigger action has already been collected during CREATE TRIGGER time and hence we can use that available information about column positions to do the transformation of OLD/NEW transient references. More information on case 1) above. DERBY-1482 One of the work done by this method for row level triggers is to find the columns which are referenced in the trigger action through the REFERENCES clause ie thro old/new transition variables. This information will be saved in SYSTRIGGERS so it can be retrieved during the trigger execution time. The purpose of this is to recognize what columns from the trigger table should be read in during trigger execution. Before these code changes, during trigger execution, Derby was opting to read all the columns from the trigger table even if they were not all referenced during the trigger execution. This caused Derby to run into OOM at times when it could really be avoided. We go through the trigger action text and collect the column positions of all the REFERENCEd columns through new/old transition variables. We keep that information in SYSTRIGGERS. At runtime, when the trigger is fired, we will look at this information along with trigger columns from the trigger definition and only fetch those columns into memory rather than all the columns from the trigger table. This is especially useful when the table has LOB columns and those columns are not referenced in the trigger action and are not recognized as trigger columns. For such cases, we can avoid reading large values of LOB columns into memory and thus avoiding possibly running into OOM errors. If there are no trigger columns defined on the trigger, we will read all the columns from the trigger table when the trigger fires because no specific columns were identified as trigger column by the user. The other case where we will opt to read all the columns are when trigger columns and REFERENCING clause is identified for the trigger but there is no trigger action column information in SYSTRIGGERS. This can happen for triggers created prior to 10.7 release and later that database got hard/soft-upgraded to 10.7 or higher release.- Parameters:
actionStmt
- This is needed to get access to the various nodes generated by the Parser for the trigger action sql. These nodes will be used to find REFERENCEs column nodes.oldReferencingName
- The name specified by the user for REFERENCEs to old row columnsnewReferencingName
- The name specified by the user for REFERENCEs to new row columnstriggerDefinition
- The original trigger action text provided by the user during CREATE TRIGGER time.referencedCols
- Trigger is defined on these columns (will be null in case of INSERT AND DELETE Triggers. Can also be null for DELETE Triggers if UPDATE trigger is not defined on specific column(s))referencedColsInTriggerAction
- what columns does the trigger action reference through old/new transition variables (may be null)actionOffset
- offset of start of action clausetriggerTableDescriptor
- Table descriptor for trigger tabletriggerEventMask
- TriggerDescriptor.TRIGGER_EVENT_XXXcreateTriggerTime
- True if here for CREATE TRIGGER, false if here because an invalidated row level trigger with REFERENCEd columns has been fired and hence trigger action sql associated with SPSDescriptor may be invalid too.replacements
- a list that will be populated with objects that describe howtriggerDefinition
has been transformed into the returned SQL text. Each element in the list will contain four integers. The first two describe the begin and end offset of the replaced text in thetriggerDefinition
. The last two describe the begin and end offset of the replacement text in the returned string. The begin offsets are inclusive, whereas the end offsets are exclusive. The list can benull
if the caller does not care about this information.- Returns:
- Transformed trigger action sql
- Throws:
StandardException
-
getTriggerDescriptors
Load up the trigger descriptor list for this table descriptor and return it. If the descriptor list is already loaded up, it is returned without further ado. The descriptors are returned in the order in which the triggers were created, with the oldest first.- Parameters:
td
- The table descriptor.- Returns:
- The ConstraintDescriptorList for the table
- Throws:
StandardException
- Thrown on failure
-
updateTriggerDescriptor
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 TriggerescriptorformerUUID
- 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- Throws:
StandardException
- Thrown on failure
-
dropTriggerDescriptor
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 droptc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
hashAllConglomerateDescriptorsByNumber
Hashtable<Long,ConglomerateDescriptor> 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
Hashtable<UUID,TableDescriptor> 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
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
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. If the uuid argument is null, then this method retrieves descriptors for all of the conglomerates in the database.- Parameters:
uuid
- The UUID- Returns:
- An array of ConglomerateDescriptors for the conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptor
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
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
ConglomerateDescriptor getConglomerateDescriptor(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 forsd
- The schema descriptorforUpdate
- 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
void dropConglomerateDescriptor(ConglomerateDescriptor conglomerate, TransactionController tc) throws StandardException Drops a conglomerate descriptor- Parameters:
conglomerate
- The ConglomerateDescriptor for the conglomeratetc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
dropAllConglomerateDescriptors
void dropAllConglomerateDescriptors(TableDescriptor td, TransactionController tc) throws StandardException Drops all conglomerates associated with a table.- Parameters:
td
- The TableDescriptor of the tabletc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
updateConglomerateDescriptor
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 ConglomerateDescriptorsconglomerateNumber
- The new conglomerate numbertc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
updateConglomerateDescriptor
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 ConglomerateDescriptorconglomerateNumber
- The new conglomerate numbertc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
getDependentsDescriptorList
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
Gets a list of the dependency descriptors for the given provider's id.- Parameters:
providerID
- The ID of the provider we're interested in- 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
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
void dropStoredDependency(DependencyDescriptor dd, TransactionController tc) throws StandardException Drop a dependency from the data dictionary.- Parameters:
dd
- The DependencyDescriptor.tc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
dropDependentsStoredDependencies
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 uuidtc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on failure
-
getUUIDFactory
UUIDFactory getUUIDFactory()Get the UUID Factory. (No need to make the UUIDFactory a module.)- Returns:
- UUIDFactory The UUID Factory for this DataDictionary.
-
getAliasDescriptorForUDT
AliasDescriptor getAliasDescriptorForUDT(TransactionController tc, DataTypeDescriptor dtd) throws StandardException Get the alias descriptor for an ANSI UDT.- Parameters:
tc
- The transaction to use: if null, use the compilation transactiondtd
- The UDT's type descriptor- Returns:
- The UDT's alias descriptor if it is an ANSI UDT; null otherwise.
- Throws:
StandardException
-
getAliasDescriptor
Get an AliasDescriptor given its UUID.- Parameters:
uuid
- The UUID- Returns:
- The AliasDescriptor for method alias.
- Throws:
StandardException
- Thrown on failure
-
getAliasDescriptor
AliasDescriptor getAliasDescriptor(String schemaID, String aliasName, char nameSpace) throws StandardException Get a AliasDescriptor by alias name and name space. NOTE: caller responsible for handling no match.- Parameters:
schemaID
- schema identifieraliasName
- The alias name.nameSpace
- The alias name space.- Returns:
- AliasDescriptor AliasDescriptor for the alias name and name space
- Throws:
StandardException
- Thrown on failure
-
getRoutineList
List<AliasDescriptor> getRoutineList(String schemaID, String routineName, char nameSpace) throws StandardException Get the list of routines matching the schema and routine name.- Throws:
StandardException
-
dropAliasDescriptor
Drop an AliasDescriptor from the DataDictionary- Parameters:
ad
- The AliasDescriptor to droptc
- The TransactionController- Throws:
StandardException
- Thrown on failure
-
updateUser
Update a user. Changes all columns in the corresponding SYSUSERS row except for the user name.- Parameters:
newDescriptor
- New values for columns in the SYSUSERS row.tc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
getUser
Return the credentials descriptor for the named user.- Parameters:
userName
- Name of the user whose credentials we want.- Throws:
StandardException
- Thrown on failure
-
dropUser
Drop a User from the DataDictionary- Parameters:
userName
- The user to drop.tc
- The TransactionController- Throws:
StandardException
- Thrown on failure
-
getEngineType
int getEngineType() -
getFileInfoDescriptor
Get a FileInfoDescriptor given its id.- Parameters:
id
- The descriptor's id.- Throws:
StandardException
- Thrown on failure
-
getFileInfoDescriptor
Get a FileInfoDescriptor given its SQL name and schema name.- Parameters:
sd
- the schema that holds the FileInfoDescriptor.name
- SQL name of file.- Throws:
StandardException
- Thrown on failure
-
dropFileInfoDescriptor
Drop a FileDescriptor from the datadictionary.- Throws:
StandardException
- Oops
-
computeAutoincRowLocations
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:
StandardException
- if an error happens
-
getRowLocationTemplate
RowLocation getRowLocationTemplate(LanguageConnectionContext lcc, TableDescriptor td) throws StandardException - Throws:
StandardException
-
getSetAutoincrementValue
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
void setAutoincrementValue(TransactionController tc, UUID tableUUID, 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.tableUUID
- Table DescriptorcolumnName
- 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
-
computeSequenceRowLocation
void computeSequenceRowLocation(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) throws StandardException Computes the RowLocation in SYSSEQUENCES for a particular sequence. Also constructs the sequence descriptor.- Parameters:
tc
- Transaction Controller to use.sequenceIDstring
- UUID of the sequence as a stringrowLocation
- OUTPUT param for returing the row locationsequenceDescriptor
- OUTPUT param for return the sequence descriptor- Throws:
StandardException
- thrown on failure.
-
updateCurrentSequenceValue
boolean updateCurrentSequenceValue(TransactionController tc, RowLocation rowLocation, boolean wait, Long oldValue, Long newValue) throws StandardException Set the current value of an ANSI/ISO sequence. This method does not perform any sanity checking but assumes that the caller knows what they are doing. If the old value on disk is not what we expect it to be, then we are in a race with another session. They won and we don't update the value on disk. However, if the old value is null, that is a signal to us that we should update the value on disk anyway.- Parameters:
tc
- Transaction Controller to use.rowLocation
- Row in SYSSEQUENCES to update.wait
- True if we should wait for locksoldValue
- What we expect to find in the CURRENTVALUE column.newValue
- What to stuff into the CURRENTVALUE column.- Returns:
- Returns true if the value was successfully updated, false if we lost a race with another session.
- Throws:
StandardException
- thrown on failure.
-
getCurrentValueAndAdvance
void getCurrentValueAndAdvance(String sequenceUUIDstring, NumberDataValue returnValue) throws StandardException Get the next number from an ANSI/ISO sequence generator which was created with the CREATE SEQUENCE statement. May raise an exception if the sequence was defined as NO CYCLE and the range of the sequence is exhausted. May allocate a range of sequence numbers and update the CURRENTVALUE column of the corresponding row in SYSSEQUENCES. This work is done in the execution transaction of the current session.- Parameters:
sequenceUUIDstring
- String value of the UUID which identifies the sequencereturnValue
- This is a data value to be stuffed with the next sequence number.- Throws:
StandardException
- if the sequence does not cycle and its range is exhausted
-
peekAtIdentity
Peek at the next value which will be returned by an identity generator.
- Throws:
StandardException
-
peekAtSequence
Peek at the next value which will be returned by a sequence generator.
- Throws:
StandardException
-
getStatisticsDescriptors
Gets all statistics Descriptors for a given table.- Throws:
StandardException
-
dropStatisticsDescriptors
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 tablereferenceUUID
- UUID of the index. This can be null.tc
- Transcation Controller to use.- Throws:
StandardException
-
getDependencyManager
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:
-
getCacheMode
int getCacheMode()Returns the cache mode of the data dictionary. -
getSystemSQLName
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
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:
-
addDescriptorArray
void addDescriptorArray(TupleDescriptor[] tuple, TupleDescriptor parent, int catalogNumber, boolean allowsDuplicates, TransactionController tc) throws StandardException array version of addDescriptor.- Throws:
StandardException
- See Also:
-
checkVersion
Check to see if a database has been upgraded to the required level in order to use a langauge feature that is.This is used to ensure new functionality that would lead on disk information not understood by a previous release is not executed while in soft upgrade mode. Ideally this is called at compile time and the parser has a utility method to enable easy use at parse time.
To use this method, a feature implemented in a certain release (DataDictionary version) would call it with the constant matching the release. E.g. for a new feature added in 10.1, a call such as
// check and throw an exception if the database is not at 10.1 dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "NEW FEATURE NAME");
This call would occur during the compile time, usually indirectly through the parser utility method, but direct calls can be made during QueryNode initialization, or even at bind time.
It is not expected that this method would be called at execution time.- Parameters:
majorVersion
- Data Dictionary major version (DataDictionary.DD_ constant)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
-
isReadOnlyUpgrade
boolean isReadOnlyUpgrade()Check if the database is read only and requires some form of upgrade that makes the stored prepared statements invalid.- Returns:
true
if the stored prepared statements are invalid because of an upgrade and the database is read only,false
otherwise
-
addRemovePermissionsDescriptor
boolean addRemovePermissionsDescriptor(boolean add, PermissionsDescriptor perm, String grantee, TransactionController tc) throws StandardException Add or remove a permission to the permission database.- Parameters:
add
- if true then add the permission, if false remove it.perm
-grantee
-tc
-- Returns:
- True means revoke has removed a privilege from system table and hence the caller of this method should send invalidation actions to PermssionDescriptor's dependents.
- Throws:
StandardException
-
getTablePermissions
TablePermsDescriptor getTablePermissions(UUID tableUUID, String authorizationId) throws StandardException Get one user's privileges on a table using tableUUID and authorizationid- Parameters:
tableUUID
-authorizationId
- The user name- Returns:
- a TablePermsDescriptor or null if the user has no permissions on the table.
- Throws:
StandardException
-
getTablePermissions
Get one user's privileges on a table using tablePermsUUID- Parameters:
tablePermsUUID
-- Returns:
- a TablePermsDescriptor
- Throws:
StandardException
-
getColumnPermissions
ColPermsDescriptor getColumnPermissions(UUID tableUUID, int privType, boolean forGrant, String authorizationId) throws StandardException Get one user's column privileges for a table.- Parameters:
tableUUID
-privType
- Authorizer.SELECT_PRIV, Authorizer.UPDATE_PRIV, or Authorizer.REFERENCES_PRIVforGrant
-authorizationId
- The user name- Returns:
- a ColPermsDescriptor or null if the user has no separate column permissions of the specified type on the table. Note that the user may have been granted permission on all the columns of the table (no column list), in which case this routine will return null. You must also call getTablePermissions to see if the user has permission on a set of columns.
- Throws:
StandardException
-
getColumnPermissions
ColPermsDescriptor getColumnPermissions(UUID tableUUID, String privTypeStr, boolean forGrant, String authorizationId) throws StandardException Get one user's column privileges for a table. This routine gets called during revoke privilege processing- Parameters:
tableUUID
-privTypeStr
- (as String) Authorizer.SELECT_PRIV, Authorizer.UPDATE_PRIV, or Authorizer.REFERENCES_PRIVforGrant
-authorizationId
- The user name- Returns:
- a ColPermsDescriptor or null if the user has no separate column permissions of the specified type on the table. Note that the user may have been granted permission on all the columns of the table (no column list), in which case this routine will return null. You must also call getTablePermissions to see if the user has permission on a set of columns.
- Throws:
StandardException
-
getColumnPermissions
Get one user's column privileges on a table using colPermsUUID- Parameters:
colPermsUUID
-- Returns:
- a ColPermsDescriptor
- Throws:
StandardException
-
getRoutinePermissions
RoutinePermsDescriptor getRoutinePermissions(UUID routineUUID, String authorizationId) throws StandardException Get one user's permissions for a routine (function or procedure).- Parameters:
routineUUID
-authorizationId
- The user's name- Returns:
- The descriptor of the users permissions for the routine.
- Throws:
StandardException
-
getRoutinePermissions
Get one user's privileges for a routine using routinePermsUUID- Parameters:
routinePermsUUID
-- Returns:
- a RoutinePermsDescriptor
- Throws:
StandardException
-
getVTIClass
Return the Java class to use for the VTI to which the received table descriptor maps. There are two kinds of VTI mappings that we do: the first is for "table names", the second is for "table function names". Table names can only be mapped to VTIs that do not accept any arguments; any VTI that has at least one constructor which accepts one or more arguments must be mapped from a table *function* name. An example of a VTI "table name" is the following: select * from SYSCS_DIAG.LOCK_TABLE In this case "SYSCS_DIAG.LOCK_TABLE" is the table name that we want to map. Since the corresonding VTI does not accept any arguments, this VTI table name can be used anywhere a normal base table name can be used. An example of a VTI "table function name" is the following: select * from TABLE(SYSCS_DIAG.SPACE_TABLE(?)) x In this case "SYSCS_DIAG.SPACE_TABLE" is the table function name that we want to map. Since the corresponding VTI can take either one or two arguments we have to use the TABLE constructor syntax to pass the argument(s) in as if we were making a function call. Hence the term "table function".- Parameters:
td
- Table descriptor used for the VTI look-up.asTableFunction
- If false then treat td's descriptor name as a VTI "table name"; if true, treat the descriptor name as a VTI "table function name".- Returns:
- Java class name to which "td" maps, or null if no mapping is found.
- Throws:
StandardException
-
getBuiltinVTIClass
Return the Java class to use for a builtin VTI to which the received table descriptor maps.- Parameters:
td
- Table descriptor used for the VTI look-up.asTableFunction
- If false then treat td's descriptor name as a VTI "table name"; if true, treat the descriptor name as a VTI "table function name".- Returns:
- Java class name of builtin VTI to which "td" maps, or null if no mapping is found.
- Throws:
StandardException
-
getRoleDefinitionDescriptor
Get a role grant descriptor for a role definition.- Parameters:
roleName
- The name of the role whose definition we seek- Throws:
StandardException
- error
-
getRoleGrantDescriptor
Get the role grant descriptor corresponding to the uuid provided- Parameters:
uuid
-- Returns:
- The descriptor for the role grant descriptor
- Throws:
StandardException
- Thrown on error
-
getRoleGrantDescriptor
RoleGrantDescriptor getRoleGrantDescriptor(String roleName, String grantee, String grantor) throws StandardException Get a descriptor for a role grant- Parameters:
roleName
- The name of the role whose definition we seekgrantee
- The granteegrantor
- The grantor- Throws:
StandardException
- error
-
dropDependentsStoredDependencies
void dropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc, boolean wait) throws StandardException Remove all of the stored dependencies for a given dependent's ID from the data dictionary.- Parameters:
dependentsUUID
- Dependent's uuidtc
- TransactionController for the transactionwait
- If true, then the caller wants to wait for locks. False will be when we using a nested user xaction - we want to timeout right away if the parent holds the lock.- Throws:
StandardException
- Thrown on failure
-
existsGrantToAuthid
Check all dictionary tables and return true if there is any GRANT descriptor containingauthId
as its grantee.- Parameters:
authId
- grantee for which a grant exists or nottc
- TransactionController for the transaction- Returns:
- boolean true if such a grant exists
- Throws:
StandardException
-
updateMetadataSPSes
Drop and recreate metadata stored prepared statements.- Parameters:
tc
- the xact- Throws:
StandardException
-
dropSequenceDescriptor
void dropSequenceDescriptor(SequenceDescriptor sequenceDescriptor, TransactionController tc) throws StandardException Drop a sequence descriptor.- Parameters:
sequenceDescriptor
-tc
-- Throws:
StandardException
-
getSequenceDescriptor
get a descriptor for a Sequence by uuid- Parameters:
uuid
- uuid of the sequence- Returns:
- the SequenceDescriptor
- Throws:
StandardException
- error
-
getSequenceDescriptor
SequenceDescriptor getSequenceDescriptor(SchemaDescriptor sd, String sequenceName) throws StandardException get a descriptor for a Sequence by sequence name- Parameters:
sd
- The scemadescriptor teh sequence belongs tosequenceName
- Name of the sequence- Returns:
- The SequenceDescriptor
- Throws:
StandardException
- error
-
getGenericPermissions
PermDescriptor getGenericPermissions(UUID objectUUID, String objectType, String privilege, String granteeAuthId) throws StandardException Get permissions granted to one user for an object using the object's Id and the user's authorization Id.- Parameters:
objectUUID
- ID of the object being protectedobjectType
- Type of the object (e.g., PermDescriptor.SEQUENCE_TYPE)privilege
- The kind of privilege needed (e.g., PermDescriptor.USAGE_PRIV)granteeAuthId
- The user who needs the permission- Returns:
- The descriptor of the permissions for the object
- Throws:
StandardException
-
getGenericPermissions
Get one user's privileges for an object using the permUUID- Parameters:
permUUID
-- Returns:
- a PermDescriptor
- Throws:
StandardException
-
dropAllPermDescriptors
Drops all permission descriptors for the given object- Parameters:
objectID
- The UUID of the object from which to drop all permissionstc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on error
-
doCreateIndexStatsRefresher
boolean doCreateIndexStatsRefresher()Tells if an index statistics refresher should be created for this database.The only reason not to create an index statistics refresher is if one already exists.
- Returns:
true
if an index statistics refresher should be created,false
if one already exists.
-
createIndexStatsRefresher
Creates an index statistics refresher for this data dictionary.The index statistics refresher is used to create and refresh index cardinality statistics, either automatically or on user demand (i.e. by invoking SYSCS_UTIL.SYSCS_UPDATE_STATISTICS).
- Parameters:
db
- the database object associated with this data dictionarydatabaseName
- the name of the database
-
getIndexStatsRefresher
Returns the index statistics refresher.- Parameters:
asDaemon
- whether the usage is automatic (true
) or explicit (false
)- Returns:
- The index statistics refresher instance, or
null
if disabled. IfasDaemon
isfalse
, an instance will always be returned.
-
disableIndexStatsRefresher
void disableIndexStatsRefresher()Disables automatic refresh/creation of index statistics at runtime.If the daemon is disabled, it can only be enabled again by rebooting the database. Note that this method concerns diabling the daemon at runtime, and only the automatic updates of statistics. If wanted, the user would disable the daemon at boot-time by setting a property (system-wide or database property).
Usage note: This method was added to allow the index refresher itself to notify the data dictionary that it should be disabled. This only happens if the refresher/daemon experiences severe errors, or a large amount of errors. It would then disable itself to avoid eating up system resources and potentially cause side-effects due to the errors.
-
getDependableFinder
Get aDependableFinder
instance.- Parameters:
formatId
- the format id- Returns:
- an instance capable of finding
Dependable
s with the specified format id
-
getColumnDependableFinder
Get aDependableFinder
instance for referenced columns in a table.- Parameters:
formatId
- the format idcolumnBitMap
- byte array encoding the bitmap of referenced columns- Returns:
- an instance capable of finding
Dependable
s with the specified format id
-
getBulkInsertCounter
BulkInsertCounter getBulkInsertCounter(String sequenceUUIDString, boolean restart) throws StandardException Get the identity generator used to support the bulk-insert optimization in InsertResultSet.- Parameters:
sequenceUUIDString
- UUID of the sequence which backs the identity column.restart
- True if the counter should be re-initialized to its start position.- Throws:
StandardException
-
flushBulkInsertCounter
void flushBulkInsertCounter(String sequenceUUIDString, BulkInsertCounter bic) throws StandardException Flush the updated values of the BulkInsertCounter to disk and to the original, cached SequenceUpdater. This is used for the bulk-insert optimization in InsertResultSet.- Parameters:
sequenceUUIDString
- UUID of the sequence which backs the identity column.bic
- the BulkInsertCounter which generates identities for bulk insert- Throws:
StandardException
-