Class DataDictionaryImpl
- java.lang.Object
-
- org.apache.derby.impl.sql.catalog.DataDictionaryImpl
-
- All Implemented Interfaces:
- java.security.PrivilegedAction<java.util.Properties>, CacheableFactory, ModuleControl, ModuleSupportable, DataDictionary
public final class DataDictionaryImpl extends java.lang.Object implements DataDictionary, CacheableFactory, ModuleControl, ModuleSupportable, java.security.PrivilegedAction<java.util.Properties>
Standard database implementation of the data dictionary that stores the information in the system catalogs.
-
-
Field Summary
Fields Modifier and Type Field and Description DataDescriptorGeneratordataDescriptorGeneratorLockFactorylockFactory-
Fields inherited from interface org.apache.derby.iapi.sql.dictionary.DataDictionary
CATALOG_TYPE_SYSTEM_IDENTIFIER, CHECK_CONSTRAINT, COMPILE_ONLY_MODE, CORE_DATA_DICTIONARY_VERSION, CREATE_DATA_DICTIONARY_VERSION, DATABASE_ID, DD_VERSION_CS_10_0, DD_VERSION_CS_5_0, DD_VERSION_CS_5_1, DD_VERSION_CS_5_2, DD_VERSION_CS_8_1, DD_VERSION_CURRENT, DD_VERSION_DERBY_10_1, DD_VERSION_DERBY_10_10, DD_VERSION_DERBY_10_11, DD_VERSION_DERBY_10_2, DD_VERSION_DERBY_10_3, DD_VERSION_DERBY_10_4, DD_VERSION_DERBY_10_5, DD_VERSION_DERBY_10_6, DD_VERSION_DERBY_10_7, DD_VERSION_DERBY_10_8, DD_VERSION_DERBY_10_9, DDL_MODE, DROP_CONSTRAINT, FOREIGNKEY_CONSTRAINT, MODIFY_CONSTRAINT, MODULE, NOTNULL_CONSTRAINT, PRIMARYKEY_CONSTRAINT, PROPERTY_CONGLOMERATE_VERSION, SOFT_DATA_DICTIONARY_VERSION, SYSALIASES_CATALOG_NUM, SYSCHECKS_CATALOG_NUM, SYSCOLPERMS_CATALOG_NUM, SYSCOLUMNS_CATALOG_NUM, SYSCONGLOMERATES_CATALOG_NUM, SYSCONSTRAINTS_CATALOG_NUM, SYSDEPENDS_CATALOG_NUM, SYSDUMMY1_CATALOG_NUM, SYSFILES_CATALOG_NUM, SYSFOREIGNKEYS_CATALOG_NUM, SYSKEYS_CATALOG_NUM, SYSPERMS_CATALOG_NUM, SYSROLES_CATALOG_NUM, SYSROUTINEPERMS_CATALOG_NUM, SYSSCHEMAS_CATALOG_NUM, SYSSEQUENCES_CATALOG_NUM, SYSSTATEMENTS_CATALOG_NUM, SYSSTATISTICS_CATALOG_NUM, SYSTABLEPERMS_CATALOG_NUM, SYSTABLES_CATALOG_NUM, SYSTRIGGERS_CATALOG_NUM, SYSUSERS_CATALOG_NUM, SYSVIEWS_CATALOG_NUM, TYPE_SYSTEM_IDENTIFIER, UNIQUE_CONSTRAINT
-
-
Constructor Summary
Constructors Constructor and Description DataDictionaryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanactiveConstraint(ConstraintDescriptor constraint)Reports whether an individual constraint must be enforced.voidaddConstraintDescriptor(ConstraintDescriptor descriptor, TransactionController tc)Adds the given ConstraintDescriptor to the data dictionary, associated with the given table and constraint type.voidaddDescriptor(TupleDescriptor td, TupleDescriptor parent, int catalogNumber, boolean duplicatesAllowed, TransactionController tc)Adds a descriptor to a system catalog identified by the catalogNumber.voidaddDescriptorArray(TupleDescriptor[] td, TupleDescriptor parent, int catalogNumber, boolean allowDuplicates, TransactionController tc)array version of addDescriptor.booleanaddRemovePermissionsDescriptor(boolean add, PermissionsDescriptor perm, java.lang.String grantee, TransactionController tc)Add or remove a permission to/from the permission database.voidaddSPSDescriptor(SPSDescriptor descriptor, TransactionController tc)Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.voidaddTableDescriptorToOtherCache(TableDescriptor td, Cacheable c)Add a table descriptor to the "other" cache.voidboot(boolean create, java.util.Properties startParams)Start-up method for this instance of the data dictionary.booleancanSupport(java.util.Properties startParams)This is the data dictionary implementation for the standard database engine.booleancheckVersion(int requiredMajorVersion, java.lang.String feature)Check to see if a database has been upgraded to the required level in order to use a language feature.voidclearCaches()Clear all of the DataDictionary caches.voidclearCaches(boolean clearSequenceCaches)Clear the DataDictionary caches, including the sequence caches if requested..voidclearSequenceCaches()Flush sequence caches to disk so that we don't leak unused, pre-allocated numbers.RowLocation[]computeAutoincRowLocations(TransactionController tc, TableDescriptor td)returns an array of RowLocations corresponding to the autoincrement columns in the table.voidcomputeSequenceRowLocation(TransactionController tc, java.lang.String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor)Computes the RowLocation in SYSSEQUENCES for a particular sequence.voidcreateIndexStatsRefresher(Database db, java.lang.String dbName)Creates an index statistics refresher for this data dictionary.RoleClosureIteratorcreateRoleClosureIterator(TransactionController tc, java.lang.String role, boolean inverse)This method creates a new iterator over the closure of role grants starting or ending with a given role.voiddisableIndexStatsRefresher()Disables automatic refresh/creation of index statistics at runtime.booleandoCreateIndexStatsRefresher()Tells if an index statistics refresher should be created for this database.voiddoneReading(int mode, LanguageConnectionContext lcc)Inform this DataDictionary that we have finished reading it.voiddropAliasDescriptor(AliasDescriptor ad, TransactionController tc)Drop a AliasDescriptor from the DataDictionaryvoiddropAllColumnDescriptors(UUID tableID, TransactionController tc)Drops all column descriptors from the given table.voiddropAllConglomerateDescriptors(TableDescriptor td, TransactionController tc)Drops all conglomerates associated with a table.voiddropAllConstraintDescriptors(TableDescriptor table, TransactionController tc)Drops all ConstraintDescriptors from the data dictionary that are associated with the given table,voiddropAllPermDescriptors(UUID objectID, TransactionController tc)Drops all permission descriptors for the object whose Id is given.voiddropAllPermsByGrantee(java.lang.String authId, TransactionController tc)Drop all permission descriptors corresponding to a grant to the named authentication identifiervoiddropAllRoutinePermDescriptors(UUID routineID, TransactionController tc)Drops all routine permission descriptors for the given routine.voiddropAllTableAndColPermDescriptors(UUID tableID, TransactionController tc)Drops all table and column permission descriptors for the given table.voiddropColumnDescriptor(UUID tableID, java.lang.String columnName, TransactionController tc)Given a column name and a table ID, drops the column descriptor from the table.voiddropConglomerateDescriptor(ConglomerateDescriptor conglomerate, TransactionController tc)Drops a conglomerate descriptorvoiddropConstraintDescriptor(ConstraintDescriptor descriptor, TransactionController tc)Drops the given ConstraintDescriptor from the data dictionary.voiddropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc)Remove all of the stored dependencies for a given dependent's ID from the data dictionary.voiddropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc, boolean wait)Remove all of the stored dependencies for a given dependent's ID from the data dictionary.voiddropFileInfoDescriptor(FileInfoDescriptor fid)Drop a FileDescriptor from the datadictionary.voiddropRoleGrant(java.lang.String roleName, java.lang.String grantee, java.lang.String grantor, TransactionController tc)Drop a role grantvoiddropRoleGrantsByGrantee(java.lang.String grantee, TransactionController tc)Drop all role grants corresponding to a grant of (any) role to a named authentication identifiervoiddropRoleGrantsByName(java.lang.String roleName, TransactionController tc)Drop all role grants corresponding to a grant of the named role to any authentication identifiervoiddropSchemaDescriptor(java.lang.String schemaName, TransactionController tc)Drop the descriptor for a schema, given the schema's namevoiddropSequenceDescriptor(SequenceDescriptor descriptor, TransactionController tc)Drops a sequence descriptorvoiddropSPSDescriptor(SPSDescriptor descriptor, TransactionController tc)Drops the given SPSDescriptor.voiddropSPSDescriptor(UUID uuid, TransactionController tc)Drops the given SPSDescriptor.voiddropStatisticsDescriptors(UUID tableUUID, UUID referenceUUID, TransactionController tc)Drops all statistics descriptors for a given table/index column combination.voiddropStoredDependency(DependencyDescriptor dd, TransactionController tc)Drop a single dependency from the data dictionary.voiddropTableDescriptor(TableDescriptor td, SchemaDescriptor schema, TransactionController tc)Drop the table descriptor.voiddropTriggerDescriptor(TriggerDescriptor descriptor, TransactionController tc)Drops the given TriggerDescriptor.voiddropUser(java.lang.String userName, TransactionController tc)Drop a User from the DataDictionaryvoiddropViewDescriptor(ViewDescriptor vd, TransactionController tc)Drops the view descriptor from the data dictionary.booleanexistsGrantToAuthid(java.lang.String authId, TransactionController tc)Check all dictionary tables and return true if there is any GRANT descriptor containingauthIdas its grantee.booleanexistsSchemaOwnedBy(java.lang.String authid, TransactionController tc)Return true of there exists a schema whose authorizationId equals authid, i.e.voidflushBulkInsertCounter(java.lang.String sequenceUUIDString, BulkInsertCounter bic)Flush the updated values of the BulkInsertCounter to disk and to the original, cached SequenceUpdater.ConstraintDescriptorListgetActiveConstraintDescriptors(ConstraintDescriptorList cdl)Convert a constraint descriptor list into a list of active constraints, that is, constraints which must be enforced.AliasDescriptorgetAliasDescriptor(java.lang.String schemaId, java.lang.String aliasName, char nameSpace)Get a AliasDescriptor by alias name and name space.AliasDescriptorgetAliasDescriptor(UUID uuid)Get a AliasDescriptor given its UUID.AliasDescriptorgetAliasDescriptorForUDT(TransactionController tc, DataTypeDescriptor dtd)Get the alias descriptor for an ANSI UDT.java.util.List<TupleDescriptor>getAllDependencyDescriptorsList()Build and return an List with DependencyDescriptors for all of the stored dependencies.java.util.List<SPSDescriptor>getAllSPSDescriptors()Get every statement in this database.java.lang.StringgetAuthorizationDatabaseOwner()Get authorizationID of Database Ownerjava.lang.StringgetBuiltinVTIClass(TableDescriptor td, boolean asTableFunction)Return the Java class to use for a builtin VTI to which the received table descriptor maps.BulkInsertCountergetBulkInsertCounter(java.lang.String sequenceUUIDString, boolean restart)Get the identity generator used to support the bulk-insert optimization in InsertResultSet.intgetCacheMode()Returns the cache mode of the data dictionary.intgetCollationTypeOfSystemSchemas()Return the collation type for SYSTEM schemas.intgetCollationTypeOfUserSchemas()Return the collation type for user schemas.DependableFindergetColumnDependableFinder(int formatId, byte[] columnBitMap)Get aDependableFinderinstance for referenced columns in a table.ColumnDescriptorgetColumnDescriptorByDefaultId(UUID uuid)Get a ColumnDescriptor given its Default ID.ColPermsDescriptorgetColumnPermissions(UUID colPermsUUID)Get one user's column privileges on a table using colPermsUUIDColPermsDescriptorgetColumnPermissions(UUID tableUUID, int privType, boolean forGrant, java.lang.String authorizationId)Get one user's column privileges for a table.ColPermsDescriptorgetColumnPermissions(UUID tableUUID, java.lang.String privTypeStr, boolean forGrant, java.lang.String authorizationId)Get one user's column privileges for a table.ConglomerateDescriptorgetConglomerateDescriptor(long conglomerateNumber)Get a ConglomerateDescriptor given its conglomerate number.ConglomerateDescriptorgetConglomerateDescriptor(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.ConglomerateDescriptorgetConglomerateDescriptor(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.ConstraintDescriptorgetConstraintDescriptor(java.lang.String constraintName, UUID schemaID)Get a ConstraintDescriptor given its name and schema ID.ConstraintDescriptorgetConstraintDescriptor(TableDescriptor td, UUID uuid)Get the constraint descriptor given a table and the UUID String of the backing index.ConstraintDescriptorgetConstraintDescriptor(UUID uuid)Get a ConstraintDescriptor given its UUID.ConstraintDescriptorgetConstraintDescriptorById(TableDescriptor td, UUID uuid)Get the constraint descriptor given a table and the UUID String of the constraintConstraintDescriptorgetConstraintDescriptorByName(TableDescriptor td, SchemaDescriptor sd, java.lang.String constraintName, boolean forUpdate)Get the constraint descriptor given a TableDescriptor and the constraint name.ConstraintDescriptorListgetConstraintDescriptors(TableDescriptor td)Load up the constraint descriptor list for this table descriptor and return it.java.util.List<UUID>getConstraints(UUID uuid, int indexId, int columnNum)Return an List which of the relevant column matching the indexed criteria.TableDescriptorgetConstraintTableDescriptor(UUID constraintId)Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passsed in.voidgetCurrentValueAndAdvance(java.lang.String sequenceUUIDstring, NumberDataValue returnValue)Get the next number from an ANSI/ISO sequence generator which was created with the CREATE SEQUENCE statement.DataDescriptorGeneratorgetDataDescriptorGenerator()Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.DataValueFactorygetDataValueFactory()Get a DataValueFactory, through which we can create data value objects.SchemaDescriptorgetDeclaredGlobalTemporaryTablesSchemaDescriptor()Get the descriptor for the declared global temporary table schema which is always named "SESSION".DependableFindergetDependableFinder(int formatId)Get aDependableFinderinstance.DependencyManagergetDependencyManager()returns the dependencymanager associated with this datadictionary.java.util.List<DependencyDescriptor>getDependentsDescriptorList(java.lang.String dependentID)Gets a list of the dependency descriptors for the given dependent's id.intgetEngineType()ExecutionFactorygetExecutionFactory()Get ExecutionFactory associated with this database.FileInfoDescriptorgetFileInfoDescriptor(SchemaDescriptor sd, java.lang.String name)Get a FileInfoDescriptor given its SQL name and schema name.FileInfoDescriptorgetFileInfoDescriptor(UUID id)Get a FileInfoDescriptor given its id.ConstraintDescriptorListgetForeignKeys(UUID constraintId)Return a list of foreign keys constraints referencing this constraint.PermDescriptorgetGenericPermissions(UUID permUUID)Get one user's privileges for an object using the permUUID.PermDescriptorgetGenericPermissions(UUID objectUUID, java.lang.String objectType, java.lang.String privilege, java.lang.String granteeAuthId)Get permissions granted to one user for an object using the object's Id and the user's authorization Id.static ExecIndexRowgetIndexRowFromHeapRow(IndexRowGenerator irg, RowLocation rl, ExecRow heapRow)Get an index row based on a row from the heap.IndexStatisticsDaemongetIndexStatsRefresher(boolean asDaemon)Returns the index statistics refresher.java.util.List<DependencyDescriptor>getProvidersDescriptorList(java.lang.String providerID)Gets a list of the dependency descriptors for the given provider's id.RoleGrantDescriptorgetRoleDefinitionDescriptor(java.lang.String roleName)Get the target role definition by searching for a matching row in SYSROLES by rolename where isDef==true.RoleGrantDescriptorgetRoleGrantDescriptor(java.lang.String roleName, java.lang.String grantee, java.lang.String grantor)Get the target role by searching for a matching row in SYSROLES by rolename, grantee and grantor.RoleGrantDescriptorgetRoleGrantDescriptor(UUID uuid)Get the role grant descriptor corresponding to the uuid providedjava.util.List<AliasDescriptor>getRoutineList(java.lang.String schemaID, java.lang.String routineName, char nameSpace)Get the list of routines matching the schema and routine name.RoutinePermsDescriptorgetRoutinePermissions(UUID routinePermsUUID)Get one user's privileges for a routine using routinePermsUUIDRoutinePermsDescriptorgetRoutinePermissions(UUID routineUUID, java.lang.String authorizationId)Get one user's permissions for a routine (function or procedure).RowLocationgetRowLocationTemplate(LanguageConnectionContext lcc, TableDescriptor td)SchemaDescriptorgetSchemaDescriptor(java.lang.String schemaName, TransactionController tc, boolean raiseError)Get the descriptor for the named schema.SchemaDescriptorgetSchemaDescriptor(UUID schemaId, int isolationLevel, TransactionController tc)Get the SchemaDescriptor for the given schema identifier.SchemaDescriptorgetSchemaDescriptor(UUID schemaId, TransactionController tc)Get the SchemaDescriptor for the given schema identifier.SequenceDescriptorgetSequenceDescriptor(SchemaDescriptor sd, java.lang.String sequenceName)Get the sequence descriptor given a sequence name and a schema Id.SequenceDescriptorgetSequenceDescriptor(UUID uuid)get a descriptor for a Sequence by uuidNumberDataValuegetSetAutoincrementValue(RowLocation rl, TransactionController tc, boolean doUpdate, NumberDataValue newValue, boolean wait)getSetAutoincrementValue fetches the autoincrement value from SYSCOLUMNS given a row location.SPSDescriptorgetSPSDescriptor(java.lang.String stmtName, SchemaDescriptor sd)Get a SPSDescriptor given its name.SPSDescriptorgetSPSDescriptor(UUID uuid)Get a SPSDescriptor given its UUID.DataTypeDescriptor[]getSPSParams(SPSDescriptor spsd, java.util.List<DataValueDescriptor> defaults)Get all the parameter descriptors for an SPS.java.util.List<StatisticsDescriptor>getStatisticsDescriptors(TableDescriptor td)Returns all the statistics descriptors for the given table.SubKeyConstraintDescriptorgetSubKeyConstraint(UUID constraintId, int type)Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for the specified constraint id.longgetSYSCOLUMNSHeapConglomerateNumber()Get the heap conglomerate number for SYS.SYSCOLUMNS.SchemaDescriptorgetSysIBMSchemaDescriptor()Get the descriptor for the SYSIBM schema.SchemaDescriptorgetSystemSchemaDescriptor()Get the descriptor for the system schema.java.lang.StringgetSystemSQLName()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 The number at the end is to handle more than one system generated name request came at the same time.SchemaDescriptorgetSystemUtilSchemaDescriptor()Get the descriptor for the SYSCS_UTIL system schema.TableDescriptorgetTableDescriptor(java.lang.String tableName, SchemaDescriptor schema, TransactionController tc)Get the descriptor for the named table within the given schema.TableDescriptorgetTableDescriptor(UUID tableID)Get the descriptor for the table with the given UUID.TablePermsDescriptorgetTablePermissions(UUID tablePermsUUID)Get one user's privileges on a table using tablePermsUUIDTablePermsDescriptorgetTablePermissions(UUID tableUUID, java.lang.String authorizationId)Get one user's privileges on a tableTransactionControllergetTransactionCompile()Get the TransactionController to use, when not passed in as a parameter.TransactionControllergetTransactionExecute()Get the TransactionController to use, when not passed in as a parameter.java.lang.StringgetTriggerActionString(Visitable actionStmt, java.lang.String oldReferencingName, java.lang.String newReferencingName, java.lang.String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, java.util.List<int[]> replacements)Get the trigger action string associated with the trigger after the references to old/new transition tables/variables in trigger action sql provided by CREATE TRIGGER have been transformed eg DELETE FROM t WHERE c = old.c turns into DELETE FROM t WHERE c = org.apache.derby.iapi.db.Factory:: getTriggerExecutionContext().getOldRow().TriggerDescriptorgetTriggerDescriptor(java.lang.String name, SchemaDescriptor sd)Get the stored prepared statement descriptor given a sps name.TriggerDescriptorgetTriggerDescriptor(UUID uuid)Get a TriggerDescriptor given its UUID.TriggerDescriptorListgetTriggerDescriptors(TableDescriptor td)Load up the trigger descriptor list for this table descriptor and return it.UserDescriptorgetUser(java.lang.String userName)Return the credentials descriptor for the named user.UUIDFactorygetUUIDFactory()Get the UUID Factory.ViewDescriptorgetViewDescriptor(TableDescriptor td)Gets the viewDescriptor for the view given the TableDescriptor.ViewDescriptorgetViewDescriptor(UUID uuid)Gets the viewDescriptor for the view with the given UUID.java.lang.StringgetVTIClass(TableDescriptor td, boolean asTableFunction)Return the Java class to use for the VTI to which the received table descriptor maps.voidgrantPublicAccessToSystemRoutines(java.util.HashSet newlyCreatedRoutines, TransactionController tc, java.lang.String authorizationID)Grant PUBLIC access to specific system routines.java.util.Hashtable<java.lang.Long,ConglomerateDescriptor>hashAllConglomerateDescriptorsByNumber(TransactionController tc)Get all of the ConglomerateDescriptors in the database and hash them by conglomerate number.java.util.Hashtable<UUID,TableDescriptor>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.voidinitializeCatalogInfo()Initialize catalog information.voidinvalidateAllSPSPlans()Invalidate all the stored plans in SYS.SYSSTATEMENTS.voidinvalidateAllSPSPlans(LanguageConnectionContext lcc)Invalidate all the stored plans in SYS.SYSSTATEMENTS for the given language connection context.booleanisReadOnlyUpgrade()Check if the database is read only and requires some form of upgrade that makes the stored prepared statements invalid.booleanisSchemaEmpty(SchemaDescriptor sd)Indicate whether there is anything in the particular schema.booleanisSystemSchemaName(java.lang.String name)Determine whether a string is the name of the system schema.PasswordHashermakePasswordHasher(java.util.Dictionary<?,?> props)Get the default password hasher for this database level.CacheablenewCacheable(CacheManager cm)java.lang.LongpeekAtIdentity(java.lang.String schemaName, java.lang.String tableName)Peek at the next value which will be returned by an identity generator.java.lang.LongpeekAtSequence(java.lang.String schemaName, java.lang.String sequenceName)Peek at the next value which will be returned by a sequence generator.voidresetDatabaseOwner(TransactionController tc)Reset the database owner according to what is stored in the catalogs.java.util.Propertiesrun()voidsetAutoincrementValue(TransactionController tc, UUID tableUUID, java.lang.String columnName, long aiValue, boolean incrementNeeded)sets a new value in SYSCOLUMNS for a particular autoincrement column.intstartReading(LanguageConnectionContext lcc)Inform this DataDictionary that we are about to start reading it.voidstartWriting(LanguageConnectionContext lcc)Inform this DataDictionary that we are about to start writing to it.voidstop()Stop this module.voidtransactionFinished()Inform this DataDictionary that the transaction in which writes have been done (or may have been done) has been committed or rolled back.voidupdateConglomerateDescriptor(ConglomerateDescriptor[] cds, long conglomerateNumber, TransactionController tc)Update the conglomerateNumber for an array of ConglomerateDescriptors.voidupdateConglomerateDescriptor(ConglomerateDescriptor cd, long conglomerateNumber, TransactionController tc)Update the conglomerateNumber for a ConglomerateDescriptor.voidupdateConstraintDescriptor(ConstraintDescriptor cd, UUID formerUUID, int[] colsToSet, TransactionController tc)Update the constraint descriptor in question.booleanupdateCurrentSequenceValue(TransactionController tc, RowLocation rowLocation, boolean wait, java.lang.Long oldValue, java.lang.Long newValue)Set the current value of an ANSI/ISO sequence.voidupdateLockGranularity(TableDescriptor td, SchemaDescriptor schema, char lockGranularity, TransactionController tc)Update the lockGranularity for the specified table.voidupdateMetadataSPSes(TransactionController tc)Drop and recreate metadata stored prepared statements.voidupdateSchemaAuth(java.lang.String schemaName, java.lang.String authorizationId, TransactionController tc)Update authorizationId of specified schemaNamevoidupdateSPS(SPSDescriptor spsd, TransactionController tc, boolean recompile)Updates SYS.SYSSTATEMENTS with the info from the SPSD.voidupdateSYSCOLPERMSforAddColumnToUserTable(UUID tableID, TransactionController tc)Need to update SYSCOLPERMS for a given table because a new column has been added to that table.voidupdateSYSCOLPERMSforDropColumn(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor)Update SYSCOLPERMS due to dropping a column from a table.voidupdateSystemSchemaAuthorization(java.lang.String aid, TransactionController tc)Update all system schemas to have new authorizationId.voidupdateTriggerDescriptor(TriggerDescriptor triggerd, UUID formerUUID, int[] colsToSet, TransactionController tc)Update the trigger descriptor in question.voidupdateUser(UserDescriptor newDescriptor, TransactionController tc)Update a user.voidupgrade_addColumns(CatalogRowFactory rowFactory, int[] newColumnIDs, TransactionController tc)Upgrade an existing catalog by adding columns.voidupgrade_addInvisibleColumns(CatalogRowFactory rowFactory, int[] newColumnIDs, TransactionController tc)Add invisible columns to an existing system catalogvoidupgradeFixSystemColumnDefinition(CatalogRowFactory rowFactory, int columnNumber, TransactionController tc)Upgrade an existing system catalog column's definition by setting it to the value it would have in a newly created database.booleanusesSqlAuthorization()Get authorization model in force, SqlStandard or legacy mode
-
-
-
Field Detail
-
dataDescriptorGenerator
public DataDescriptorGenerator dataDescriptorGenerator
-
lockFactory
public LockFactory lockFactory
-
-
Method Detail
-
canSupport
public boolean canSupport(java.util.Properties startParams)
This is the data dictionary implementation for the standard database engine.- Specified by:
canSupportin interfaceModuleSupportable- Returns:
- true if this service requested is for a database engine.
-
boot
public void boot(boolean create, java.util.Properties startParams) throws StandardExceptionStart-up method for this instance of the data dictionary.- Specified by:
bootin interfaceModuleControl- Parameters:
startParams- The start-up parameters- Throws:
StandardException- Thrown if the module fails to start- See Also:
Monitor,ModuleFactory
-
getDependencyManager
public DependencyManager getDependencyManager()
returns the dependencymanager associated with this datadictionary.- Specified by:
getDependencyManagerin interfaceDataDictionary- See Also:
DataDictionary.getDependencyManager()
-
stop
public void stop()
Stop this module. In this case, nothing needs to be done.- Specified by:
stopin interfaceModuleControl- See Also:
Monitor,ModuleFactory
-
newCacheable
public Cacheable newCacheable(CacheManager cm)
- Specified by:
newCacheablein interfaceCacheableFactory
-
startReading
public int startReading(LanguageConnectionContext lcc) throws StandardException
Description copied from interface:DataDictionaryInform 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.- Specified by:
startReadingin interfaceDataDictionary- 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- See Also:
DataDictionary.startReading(org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
-
doneReading
public void doneReading(int mode, LanguageConnectionContext lcc) throws StandardExceptionDescription copied from interface:DataDictionaryInform this DataDictionary that we have finished reading it. This typically happens at the end of compilation.- Specified by:
doneReadingin interfaceDataDictionary- 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
Description copied from interface:DataDictionaryInform 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.- Specified by:
startWritingin interfaceDataDictionary- Parameters:
lcc- The LanguageConnectionContext to use.- Throws:
StandardException- Thrown on error
-
transactionFinished
public void transactionFinished() throws StandardExceptionDescription copied from interface:DataDictionaryInform this DataDictionary that the transaction in which writes have been done (or may have been done) has been committed or rolled back.- Specified by:
transactionFinishedin interfaceDataDictionary- Throws:
StandardException- Thrown on error
-
getCacheMode
public int getCacheMode()
Description copied from interface:DataDictionaryReturns the cache mode of the data dictionary.- Specified by:
getCacheModein interfaceDataDictionary
-
getDataDescriptorGenerator
public DataDescriptorGenerator getDataDescriptorGenerator()
Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.- Specified by:
getDataDescriptorGeneratorin interfaceDataDictionary- Returns:
- A DataDescriptorGenerator
-
getAuthorizationDatabaseOwner
public java.lang.String getAuthorizationDatabaseOwner()
Get authorizationID of Database Owner- Specified by:
getAuthorizationDatabaseOwnerin interfaceDataDictionary- Returns:
- authorizationID
-
usesSqlAuthorization
public boolean usesSqlAuthorization()
Description copied from interface:DataDictionaryGet authorization model in force, SqlStandard or legacy mode- Specified by:
usesSqlAuthorizationin interfaceDataDictionary- Returns:
- Whether sqlAuthorization is being used
- See Also:
DataDictionary.usesSqlAuthorization()
-
getCollationTypeOfSystemSchemas
public int getCollationTypeOfSystemSchemas()
Description copied from interface:DataDictionaryReturn the collation type for SYSTEM schemas. In Derby 10.3, this will always be UCS_BASIC- Specified by:
getCollationTypeOfSystemSchemasin interfaceDataDictionary- Returns:
- the collation type for SYSTEM schemas
- See Also:
DataDictionary.getCollationTypeOfSystemSchemas()
-
getCollationTypeOfUserSchemas
public int getCollationTypeOfUserSchemas()
Description copied from interface:DataDictionaryReturn 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.- Specified by:
getCollationTypeOfUserSchemasin interfaceDataDictionary- Returns:
- the collation type for user schemas
- See Also:
DataDictionary.getCollationTypeOfUserSchemas()
-
getDataValueFactory
public DataValueFactory getDataValueFactory()
Get a DataValueFactory, through which we can create data value objects.- Specified by:
getDataValueFactoryin interfaceDataDictionary- Returns:
- A DataValueFactory
-
getExecutionFactory
public ExecutionFactory getExecutionFactory()
Get ExecutionFactory associated with this database.- Specified by:
getExecutionFactoryin interfaceDataDictionary- Returns:
- The ExecutionFactory
-
makePasswordHasher
public PasswordHasher makePasswordHasher(java.util.Dictionary<?,?> props) throws StandardException
Description copied from interface:DataDictionaryGet the default password hasher for this database level. Returns null if the system is at rev level 10.5 or earlier.- Specified by:
makePasswordHasherin interfaceDataDictionary- Parameters:
props- The persistent properties used to configure password hashing.- Throws:
StandardException
-
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.- Specified by:
getSystemSchemaDescriptorin interfaceDataDictionary- Returns:
- The descriptor for the schema.
- Throws:
StandardException- Thrown on failure
-
getSystemUtilSchemaDescriptor
public SchemaDescriptor getSystemUtilSchemaDescriptor() throws StandardException
Get the descriptor for the SYSCS_UTIL 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.- Specified by:
getSysIBMSchemaDescriptorin interfaceDataDictionary- 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".- Specified by:
getDeclaredGlobalTemporaryTablesSchemaDescriptorin interfaceDataDictionary- Returns:
- The descriptor for the schema.
- Throws:
StandardException- Thrown on failure
-
isSystemSchemaName
public boolean isSystemSchemaName(java.lang.String name) throws StandardExceptionDetermine whether a string is the name of the system schema.- Specified by:
isSystemSchemaNamein interfaceDataDictionary- Parameters:
name-- Returns:
- true or false
- Throws:
StandardException- Thrown on failure
-
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.- Specified by:
getSchemaDescriptorin interfaceDataDictionary- 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
public SchemaDescriptor getSchemaDescriptor(UUID schemaId, TransactionController tc) throws StandardException
Get the SchemaDescriptor for the given schema identifier.- Specified by:
getSchemaDescriptorin interfaceDataDictionary- 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
public SchemaDescriptor getSchemaDescriptor(UUID schemaId, int isolationLevel, TransactionController tc) throws StandardException
Get the SchemaDescriptor for the given schema identifier.- Specified by:
getSchemaDescriptorin interfaceDataDictionary- Parameters:
schemaId- the uuid of the schema we want a descriptor forisolationLevel- use this explicit isolation level. Only ISOLATION_REPEATABLE_READ (normal usage) or ISOLATION_READ_UNCOMMITTED (corner cases) supported for now.tc- transaction controller- Returns:
- The descriptor for the schema, null if no such schema exists.
- Throws:
StandardException- thrown on error
-
existsSchemaOwnedBy
public boolean existsSchemaOwnedBy(java.lang.String authid, TransactionController tc) throws StandardExceptionReturn true of there exists a schema whose authorizationId equals authid, i.e. SYS.SYSSCHEMAS contains a row whose column (AUTHORIZATIONID) equals authid.- Specified by:
existsSchemaOwnedByin interfaceDataDictionary- Parameters:
authid- authorizationIdtc- TransactionController- Returns:
- true iff there is a matching schema
- Throws:
StandardException
-
addDescriptor
public void addDescriptor(TupleDescriptor td, TupleDescriptor parent, int catalogNumber, boolean duplicatesAllowed, TransactionController tc) throws StandardException
Description copied from interface:DataDictionaryAdds a descriptor to a system catalog identified by the catalogNumber.- Specified by:
addDescriptorin interfaceDataDictionary- Parameters:
td- 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.duplicatesAllowed- 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:
DataDictionary.addDescriptor(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[] td, TupleDescriptor parent, int catalogNumber, boolean allowDuplicates, TransactionController tc) throws StandardException
array version of addDescriptor.- Specified by:
addDescriptorArrayin interfaceDataDictionary- Throws:
StandardException- See Also:
DataDictionary.addDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor, org.apache.derby.iapi.sql.dictionary.TupleDescriptor, int, boolean, org.apache.derby.iapi.store.access.TransactionController)
-
dropRoleGrant
public void dropRoleGrant(java.lang.String roleName, java.lang.String grantee, java.lang.String grantor, TransactionController tc) throws StandardExceptionDescription copied from interface:DataDictionaryDrop a role grant- Specified by:
dropRoleGrantin interfaceDataDictionary- Parameters:
roleName- The name of the role to dropgrantee- The granteegrantor- The grantortc- Transaction Controller- Throws:
StandardException- Thrown on failure- See Also:
DataDictionary.dropRoleGrant(java.lang.String, java.lang.String, java.lang.String, org.apache.derby.iapi.store.access.TransactionController)
-
dropSchemaDescriptor
public void dropSchemaDescriptor(java.lang.String schemaName, TransactionController tc) throws StandardExceptionDrop the descriptor for a schema, given the schema's name- Specified by:
dropSchemaDescriptorin interfaceDataDictionary- Parameters:
schemaName- The name of the schema to droptc- TransactionController for the transaction- Throws:
StandardException- Thrown on error
-
getTableDescriptor
public TableDescriptor getTableDescriptor(java.lang.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.)- Specified by:
getTableDescriptorin interfaceDataDictionary- 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 system schema.tc- Transaction context.- Returns:
- The descriptor for the table, null if table does not exist.
- 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).- Specified by:
getTableDescriptorin interfaceDataDictionary- 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
-
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.- Specified by:
isSchemaEmptyin interfaceDataDictionary- Parameters:
sd- descriptor- Returns:
- true/false
- Throws:
StandardException- on error
-
dropTableDescriptor
public void dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema, TransactionController tc) throws StandardException
Drop the table descriptor.- Specified by:
dropTableDescriptorin interfaceDataDictionary- 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
public void updateLockGranularity(TableDescriptor td, SchemaDescriptor schema, char lockGranularity, TransactionController tc) throws StandardException
Update the lockGranularity for the specified table.- Specified by:
updateLockGranularityin interfaceDataDictionary- 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
public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid) throws StandardException
Get a ColumnDescriptor given its Default ID.- Specified by:
getColumnDescriptorByDefaultIdin interfaceDataDictionary- 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.- Specified by:
dropColumnDescriptorin interfaceDataDictionary- 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 error
-
dropAllColumnDescriptors
public void dropAllColumnDescriptors(UUID tableID, TransactionController tc) throws StandardException
Drops all column descriptors from the given table. Useful for DROP TABLE.- Specified by:
dropAllColumnDescriptorsin interfaceDataDictionary- Parameters:
tableID- The UUID of the table from which to drop all the column descriptorstc- TransactionController for the transaction- Throws:
StandardException- Thrown on error
-
dropAllTableAndColPermDescriptors
public void dropAllTableAndColPermDescriptors(UUID tableID, TransactionController tc) throws StandardException
Drops all table and column permission descriptors for the given table.- Specified by:
dropAllTableAndColPermDescriptorsin interfaceDataDictionary- Parameters:
tableID- The UUID of the table from which to drop all the permission descriptorstc- TransactionController for the transaction- Throws:
StandardException- Thrown on error
-
updateSYSCOLPERMSforAddColumnToUserTable
public 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 ..- Specified by:
updateSYSCOLPERMSforAddColumnToUserTablein interfaceDataDictionary- Parameters:
tableID- The UUID of the table to which a column has been addedtc- TransactionController for the transaction- Throws:
StandardException- Thrown on error
-
updateSYSCOLPERMSforDropColumn
public void updateSYSCOLPERMSforDropColumn(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor) throws StandardException
Update SYSCOLPERMS due to dropping a column from a table. Since ALTER TABLE .. DROP COLUMN .. has removed a column from the table, we need to shrink COLUMNS by removing the corresponding bit position, and shifting all the subsequent bits "left" one position.- Specified by:
updateSYSCOLPERMSforDropColumnin interfaceDataDictionary- Parameters:
tableID- The UUID of the table from which a col has been droppedtc- TransactionController for the transactioncolumnDescriptor- Information about the dropped column- Throws:
StandardException- Thrown on error
-
dropAllRoutinePermDescriptors
public void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc) throws StandardException
Drops all routine permission descriptors for the given routine.- Specified by:
dropAllRoutinePermDescriptorsin interfaceDataDictionary- Parameters:
routineID- The UUID of the routine from which to drop all the permission descriptorstc- TransactionController for the transaction- Throws:
StandardException- Thrown on error
-
dropRoleGrantsByGrantee
public void dropRoleGrantsByGrantee(java.lang.String grantee, TransactionController tc) throws StandardExceptionDescription copied from interface:DataDictionaryDrop all role grants corresponding to a grant of (any) role to a named authentication identifier- Specified by:
dropRoleGrantsByGranteein interfaceDataDictionary- Parameters:
grantee- The granteetc- Transaction Controller- Throws:
StandardException- Thrown on failure- See Also:
DataDictionary.dropRoleGrantsByGrantee(java.lang.String, org.apache.derby.iapi.store.access.TransactionController)
-
dropRoleGrantsByName
public void dropRoleGrantsByName(java.lang.String roleName, TransactionController tc) throws StandardExceptionDescription copied from interface:DataDictionaryDrop all role grants corresponding to a grant of the named role to any authentication identifier- Specified by:
dropRoleGrantsByNamein interfaceDataDictionary- Parameters:
roleName- The role name grantedtc- Transaction Controller- Throws:
StandardException- Thrown on failure- See Also:
DataDictionary.dropRoleGrantsByName(java.lang.String, org.apache.derby.iapi.store.access.TransactionController)
-
createRoleClosureIterator
public RoleClosureIterator createRoleClosureIterator(TransactionController tc, java.lang.String role, boolean inverse) throws StandardException
Description copied from interface:DataDictionaryThis 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.- Specified by:
createRoleClosureIteratorin interfaceDataDictionary- 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- See Also:
DataDictionary.createRoleClosureIterator(org.apache.derby.iapi.store.access.TransactionController, java.lang.String, boolean)
-
dropAllPermsByGrantee
public void dropAllPermsByGrantee(java.lang.String authId, TransactionController tc) throws StandardExceptionDrop all permission descriptors corresponding to a grant to the named authentication identifier- Specified by:
dropAllPermsByGranteein interfaceDataDictionary- Parameters:
authId- The authentication identifiertc- Transaction Controller- Throws:
StandardException- Thrown on failure
-
getViewDescriptor
public ViewDescriptor getViewDescriptor(UUID uuid) throws StandardException
Gets the viewDescriptor for the view with the given UUID.- Specified by:
getViewDescriptorin interfaceDataDictionary- 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 the TableDescriptor.- Specified by:
getViewDescriptorin interfaceDataDictionary- Parameters:
td- The TableDescriptor for the view.- Returns:
- A descriptor for the view
- Throws:
StandardException- Thrown on error
-
dropViewDescriptor
public void dropViewDescriptor(ViewDescriptor vd, TransactionController tc) throws StandardException
Drops the view descriptor from the data dictionary.- Specified by:
dropViewDescriptorin interfaceDataDictionary- Parameters:
vd- A descriptor for the view to be droppedtc- TransactionController to use- Throws:
StandardException- Thrown on error
-
getFileInfoDescriptor
public FileInfoDescriptor getFileInfoDescriptor(UUID id) throws StandardException
Description copied from interface:DataDictionaryGet a FileInfoDescriptor given its id.- Specified by:
getFileInfoDescriptorin interfaceDataDictionary- Parameters:
id- The descriptor's id.- Throws:
StandardException- Thrown on failure- See Also:
DataDictionary.getFileInfoDescriptor(org.apache.derby.catalog.UUID)
-
getFileInfoDescriptor
public FileInfoDescriptor getFileInfoDescriptor(SchemaDescriptor sd, java.lang.String name) throws StandardException
Description copied from interface:DataDictionaryGet a FileInfoDescriptor given its SQL name and schema name.- Specified by:
getFileInfoDescriptorin interfaceDataDictionary- Parameters:
sd- the schema that holds the FileInfoDescriptor.name- SQL name of file.- Throws:
StandardException- Thrown on failure- See Also:
DataDictionary.getFileInfoDescriptor(org.apache.derby.catalog.UUID)
-
dropFileInfoDescriptor
public void dropFileInfoDescriptor(FileInfoDescriptor fid) throws StandardException
Description copied from interface:DataDictionaryDrop a FileDescriptor from the datadictionary.- Specified by:
dropFileInfoDescriptorin interfaceDataDictionary- Throws:
StandardException- Thrown on error- See Also:
DataDictionary.dropFileInfoDescriptor(org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor)
-
getSPSDescriptor
public SPSDescriptor getSPSDescriptor(UUID uuid) throws StandardException
Get a SPSDescriptor given its UUID.- Specified by:
getSPSDescriptorin interfaceDataDictionary- Parameters:
uuid- The UUID- Returns:
- The SPSDescriptor for the constraint.
- Throws:
StandardException- Thrown on failure
-
getSPSDescriptor
public SPSDescriptor getSPSDescriptor(java.lang.String stmtName, SchemaDescriptor sd) throws StandardException
Get a SPSDescriptor given its name. Currently no cacheing. With caching we need to be very careful about invalidation. No caching means invalidations block on existing SPSD instances (since they were read in- Specified by:
getSPSDescriptorin interfaceDataDictionary- Parameters:
stmtName- the statement namesd- The SchemaDescriptor- Returns:
- The SPSDescriptor for the constraint.
- Throws:
StandardException- Thrown on failure
-
addSPSDescriptor
public void addSPSDescriptor(SPSDescriptor descriptor, TransactionController tc) throws StandardException
Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.- Specified by:
addSPSDescriptorin interfaceDataDictionary- Parameters:
descriptor- The descriptor to addtc- The transaction controller- Throws:
StandardException- Thrown on error
-
getSPSParams
public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, java.util.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.- Specified by:
getSPSParamsin interfaceDataDictionary- Parameters:
spsd- sps descriptordefaults- list for storing column defaults- Returns:
- array of data type descriptors
- Throws:
StandardException- Thrown on error
-
updateSPS
public void updateSPS(SPSDescriptor spsd, TransactionController tc, boolean recompile) throws StandardException
Updates SYS.SYSSTATEMENTS with the info from the SPSD.- Specified by:
updateSPSin interfaceDataDictionary- Parameters:
spsd- The descriptor to addtc- The transaction controllerrecompile- Whether to recompile or invalidate- Throws:
StandardException- Thrown on error
-
invalidateAllSPSPlans
public void invalidateAllSPSPlans() throws StandardExceptionDescription copied from interface:DataDictionaryInvalidate all the stored plans in SYS.SYSSTATEMENTS.- Specified by:
invalidateAllSPSPlansin interfaceDataDictionary- Throws:
StandardException- Thrown on error- See Also:
DataDictionary.invalidateAllSPSPlans(org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
-
invalidateAllSPSPlans
public void invalidateAllSPSPlans(LanguageConnectionContext lcc) throws StandardException
Description copied from interface:DataDictionaryInvalidate all the stored plans in SYS.SYSSTATEMENTS for the given language connection context.- Specified by:
invalidateAllSPSPlansin interfaceDataDictionary- Throws:
StandardException- Thrown on error- See Also:
DataDictionary.invalidateAllSPSPlans(org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
-
dropSPSDescriptor
public void dropSPSDescriptor(SPSDescriptor descriptor, TransactionController tc) throws StandardException
Drops the given SPSDescriptor.- Specified by:
dropSPSDescriptorin interfaceDataDictionary- Parameters:
descriptor- The descriptor to droptc- The TransactionController.- Throws:
StandardException- Thrown on failure
-
dropSPSDescriptor
public void dropSPSDescriptor(UUID uuid, TransactionController tc) throws StandardException
Drops the given SPSDescriptor.- Specified by:
dropSPSDescriptorin interfaceDataDictionary- Parameters:
uuid- the statement uuidtc- The TransactionController.- Throws:
StandardException- Thrown on failure
-
getAllSPSDescriptors
public java.util.List<SPSDescriptor> getAllSPSDescriptors() throws StandardException
Get every statement in this database. Return the SPSDescriptors in an list. The returned descriptors don't contain the compiled statement, so it it safe to call this method during upgrade when it isn't known if the saved statement can still be deserialized with the new version.- Specified by:
getAllSPSDescriptorsin interfaceDataDictionary- Returns:
- the list of descriptors
- Throws:
StandardException- Thrown on failure
-
getTriggerActionString
public java.lang.String getTriggerActionString(Visitable actionStmt, java.lang.String oldReferencingName, java.lang.String newReferencingName, java.lang.String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, java.util.List<int[]> replacements) throws StandardException
Get the trigger action string associated with the trigger after the references to old/new transition tables/variables in trigger action sql provided by CREATE TRIGGER have been transformed eg 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) or DELETE FROM t WHERE c in (SELECT c FROM OLD) turns into DELETE FROM t WHERE c in (SELECT c FROM new TriggerOldTransitionTable OLD)- Specified by:
getTriggerActionStringin interfaceDataDictionary- 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 howtriggerDefinitionhas 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 benullif the caller does not care about this information.- Returns:
- Transformed trigger action sql
- Throws:
StandardException
-
getTriggerDescriptor
public TriggerDescriptor getTriggerDescriptor(UUID uuid) throws StandardException
Get a TriggerDescriptor given its UUID.- Specified by:
getTriggerDescriptorin interfaceDataDictionary- 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.- Specified by:
getTriggerDescriptorin interfaceDataDictionary- Parameters:
name- The sps name.sd- The schema descriptor.- Returns:
- The TriggerDescriptor for the constraint.
- Throws:
StandardException- Thrown on failure
-
getTriggerDescriptors
public TriggerDescriptorList 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.- Specified by:
getTriggerDescriptorsin interfaceDataDictionary- Parameters:
td- The table descriptor.- Returns:
- The ConstraintDescriptorList for the table
- Throws:
StandardException- Thrown on failure
-
dropTriggerDescriptor
public void dropTriggerDescriptor(TriggerDescriptor descriptor, TransactionController tc) throws StandardException
Drops the given TriggerDescriptor. WARNING: does not drop its SPSes!!!- Specified by:
dropTriggerDescriptorin interfaceDataDictionary- Parameters:
descriptor- The descriptor to droptc- The TransactionController.- 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 that matches the uuid.- Specified by:
updateTriggerDescriptorin interfaceDataDictionary- Parameters:
triggerd- The Trigger descriptorformerUUID- 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
-
getConstraintDescriptor
public ConstraintDescriptor getConstraintDescriptor(UUID uuid) throws StandardException
Get a ConstraintDescriptor given its UUID. Please use getConstraintDescriptorById() is you have the constraints table descriptor, it is much faster.- Specified by:
getConstraintDescriptorin interfaceDataDictionary- 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. Please use getConstraintDescriptorByName() if you have the constraint's table descriptor, it is much faster.- Specified by:
getConstraintDescriptorin interfaceDataDictionary- Parameters:
constraintName- Constraint name.schemaID- The schema UUID- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException- Thrown on failure
-
getStatisticsDescriptors
public java.util.List<StatisticsDescriptor> getStatisticsDescriptors(TableDescriptor td) throws StandardException
Returns all the statistics descriptors for the given table.NOTE: As opposed to most other data dictionary lookups, this operation is performed with isolation level READ_UNCOMMITTED. The reason is to avoid deadlocks with inserts into the statistics system table.
- Specified by:
getStatisticsDescriptorsin interfaceDataDictionary- Parameters:
td-TableDescriptorfor which I need statistics- Returns:
- A list of tuple descriptors, possibly empty.
- Throws:
StandardException
-
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. If no table descriptor is passed in, then all constraint descriptors are retrieved. Note that in this case, the constraint descriptor objects may be duplicates of constraint descriptors that are hung off of the table descriptor cache.- Specified by:
getConstraintDescriptorsin interfaceDataDictionary- Parameters:
td- The table descriptor. If null, all constraint descriptors are returned.- 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.- Specified by:
getActiveConstraintDescriptorsin interfaceDataDictionary- 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- Specified by:
activeConstraintin interfaceDataDictionary- 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.- Specified by:
getConstraintDescriptorin interfaceDataDictionary- Parameters:
td- The table descriptor.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- Specified by:
getConstraintDescriptorByIdin interfaceDataDictionary- Parameters:
td- The table descriptor.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.- Specified by:
getConstraintDescriptorByNamein interfaceDataDictionary- 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
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.- Specified by:
getConstraintTableDescriptorin interfaceDataDictionary- 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 enforced and not enforced foreign keys.- Specified by:
getForeignKeysin interfaceDataDictionary- Parameters:
constraintId- The id of the referenced constraint- Returns:
- list of constraints, empty of there are none
- Throws:
StandardException- Thrown on error
-
getConstraints
public java.util.List<UUID> getConstraints(UUID uuid, int indexId, int columnNum) throws StandardException
Return an List which of the relevant column matching the indexed criteria. If nothing matches, returns an empty List (never returns null).- Parameters:
uuid- The id of the constraintindexId- The index id in SYS.SYSCONSTRAINTScolumnNum- The column to retrieve- Returns:
- a list of UUIDs in an List.
- 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.- Specified by:
addConstraintDescriptorin interfaceDataDictionary- Parameters:
descriptor- The descriptor to addtc- The transaction controller- Throws:
StandardException- Thrown on error
-
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.- Specified by:
updateConstraintDescriptorin interfaceDataDictionary- Parameters:
cd- The Constraint descriptorformerUUID- The UUID for this column in SYSCONSTRAINTS, may differ from what is incdif this is the column that is being set.colsToSet- Array of integers of columns to be modified, 1 based. May be null (all columns).tc- The TransactionController to use- Throws:
StandardException- Thrown on failure
-
dropConstraintDescriptor
public void dropConstraintDescriptor(ConstraintDescriptor descriptor, TransactionController tc) throws StandardException
Drops the given ConstraintDescriptor from the data dictionary.- Specified by:
dropConstraintDescriptorin interfaceDataDictionary- Parameters:
descriptor- The descriptor to droptc- The TransactionController- Throws:
StandardException- Thrown on error
-
dropAllConstraintDescriptors
public void dropAllConstraintDescriptors(TableDescriptor table, TransactionController tc) throws StandardException
Drops all ConstraintDescriptors from the data dictionary that are associated with the given table,- Specified by:
dropAllConstraintDescriptorsin interfaceDataDictionary- Parameters:
table- The table from which to drop all constraint descriptorstc- The TransactionController- Throws:
StandardException- Thrown on error
-
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.- Specified by:
getSubKeyConstraintin interfaceDataDictionary- 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
-
hashAllConglomerateDescriptorsByNumber
public java.util.Hashtable<java.lang.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 UNCOMMITTED.- Specified by:
hashAllConglomerateDescriptorsByNumberin interfaceDataDictionary- 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<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 and SYS.SYSSCHEMAS at READ UNCOMMITTED.- Specified by:
hashAllTableDescriptorsByTableIdin interfaceDataDictionary- 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.- Specified by:
getConglomerateDescriptorin interfaceDataDictionary- 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. If the uuid argument is null, then this method retrieves descriptors for all of the conglomerates in the database.- Specified by:
getConglomerateDescriptorsin interfaceDataDictionary- Parameters:
uuid- The UUID- Returns:
- An array of ConglomerateDescriptors for the conglomerate. returns size 0 array if no such 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.- Specified by:
getConglomerateDescriptorin interfaceDataDictionary- 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.- Specified by:
getConglomerateDescriptorsin interfaceDataDictionary- 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.- Specified by:
getConglomerateDescriptorin interfaceDataDictionary- 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
public void dropConglomerateDescriptor(ConglomerateDescriptor conglomerate, TransactionController tc) throws StandardException
Drops a conglomerate descriptor- Specified by:
dropConglomerateDescriptorin interfaceDataDictionary- Parameters:
conglomerate- The ConglomerateDescriptor for the conglomeratetc- 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.- Specified by:
dropAllConglomerateDescriptorsin interfaceDataDictionary- Parameters:
td- The TableDescriptor of the tabletc- TransactionController for the transaction- 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.)- Specified by:
updateConglomerateDescriptorin interfaceDataDictionary- Parameters:
cd- The ConglomerateDescriptorconglomerateNumber- The new conglomerate numbertc- The TransactionController to use- Throws:
StandardException- Thrown on failure
-
updateSystemSchemaAuthorization
public void updateSystemSchemaAuthorization(java.lang.String aid, TransactionController tc) throws StandardExceptionUpdate all system schemas to have new authorizationId. This is needed while upgrading pre-10.2 databases to 10.2 or later versions. From 10.2, all system schemas would be owned by database owner's authorizationId.- Parameters:
aid- AuthorizationID of Database Ownertc- TransactionController to use- Throws:
StandardException- Thrown on failure
-
updateSchemaAuth
public void updateSchemaAuth(java.lang.String schemaName, java.lang.String authorizationId, TransactionController tc) throws StandardExceptionUpdate authorizationId of specified schemaName- Parameters:
schemaName- Schema Name of system schemaauthorizationId- authorizationId of new schema ownertc- The TransactionController to use- 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, each descriptor should be updated separately, conglomerate id is not same for all the descriptors. Even when indexes are sharing the same conglomerate(conglomerate number), conglomerate ids are unique. 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.)- Specified by:
updateConglomerateDescriptorin interfaceDataDictionary- Parameters:
cds- The array of ConglomerateDescriptorsconglomerateNumber- The new conglomerate numbertc- The TransactionController to use- Throws:
StandardException- Thrown on failure
-
getDependentsDescriptorList
public java.util.List<DependencyDescriptor> getDependentsDescriptorList(java.lang.String dependentID) throws StandardException
Gets a list of the dependency descriptors for the given dependent's id.- Specified by:
getDependentsDescriptorListin interfaceDataDictionary- 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<DependencyDescriptor> getProvidersDescriptorList(java.lang.String providerID) throws StandardException
Gets a list of the dependency descriptors for the given provider's id.- Specified by:
getProvidersDescriptorListin interfaceDataDictionary- 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
public java.util.List<TupleDescriptor> getAllDependencyDescriptorsList() throws StandardException
Build and return an List with DependencyDescriptors for all of the stored dependencies. This is useful for consistency checking.- Specified by:
getAllDependencyDescriptorsListin interfaceDataDictionary- Returns:
- List List of all DependencyDescriptors.
- Throws:
StandardException- Thrown on failure
-
dropStoredDependency
public void dropStoredDependency(DependencyDescriptor dd, TransactionController tc) throws StandardException
Drop a single dependency from the data dictionary.- Specified by:
dropStoredDependencyin interfaceDataDictionary- Parameters:
dd- The DependencyDescriptor.tc- TransactionController for the transaction- 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.- Specified by:
dropDependentsStoredDependenciesin interfaceDataDictionary- Parameters:
dependentsUUID- Dependent's uuidtc- TransactionController for the transaction- Throws:
StandardException- Thrown on failure
-
dropDependentsStoredDependencies
public void dropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc, boolean wait) throws StandardException
Description copied from interface:DataDictionaryRemove all of the stored dependencies for a given dependent's ID from the data dictionary.- Specified by:
dropDependentsStoredDependenciesin interfaceDataDictionary- 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
-
getUUIDFactory
public UUIDFactory getUUIDFactory()
Get the UUID Factory. (No need to make the UUIDFactory a module.)- Specified by:
getUUIDFactoryin interfaceDataDictionary- Returns:
- UUIDFactory The UUID Factory for this DataDictionary.
-
getAliasDescriptorForUDT
public AliasDescriptor getAliasDescriptorForUDT(TransactionController tc, DataTypeDescriptor dtd) throws StandardException
Get the alias descriptor for an ANSI UDT.- Specified by:
getAliasDescriptorForUDTin interfaceDataDictionary- 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
public AliasDescriptor getAliasDescriptor(UUID uuid) throws StandardException
Get a AliasDescriptor given its UUID.- Specified by:
getAliasDescriptorin interfaceDataDictionary- Parameters:
uuid- The UUID- Returns:
- The AliasDescriptor for the 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.- Specified by:
getAliasDescriptorin interfaceDataDictionary- Parameters:
schemaId- schema identifieraliasName- The alias name.nameSpace- The alias type.- Returns:
- AliasDescriptor AliasDescriptor for the alias name and name space
- Throws:
StandardException- Thrown on failure
-
getRoutineList
public java.util.List<AliasDescriptor> getRoutineList(java.lang.String schemaID, java.lang.String routineName, char nameSpace) throws StandardException
Get the list of routines matching the schema and routine name. While we only support a single alias for a given name,namespace just return a list of zero or one item. If the schema is SYSFUN then do not use the system catalogs, but instead look up the routines from the in-memory table driven by the contents of SYSFUN_FUNCTIONS.- Specified by:
getRoutineListin interfaceDataDictionary- Throws:
StandardException
-
dropAliasDescriptor
public void dropAliasDescriptor(AliasDescriptor ad, TransactionController tc) throws StandardException
Drop a AliasDescriptor from the DataDictionary- Specified by:
dropAliasDescriptorin interfaceDataDictionary- Parameters:
ad- The AliasDescriptor to droptc- The TransactionController- Throws:
StandardException- Thrown on failure
-
updateUser
public void updateUser(UserDescriptor newDescriptor, TransactionController tc) throws StandardException
Description copied from interface:DataDictionaryUpdate a user. Changes all columns in the corresponding SYSUSERS row except for the user name.- Specified by:
updateUserin interfaceDataDictionary- Parameters:
newDescriptor- New values for columns in the SYSUSERS row.tc- The TransactionController to use- Throws:
StandardException- Thrown on failure
-
getUser
public UserDescriptor getUser(java.lang.String userName) throws StandardException
Description copied from interface:DataDictionaryReturn the credentials descriptor for the named user.- Specified by:
getUserin interfaceDataDictionary- Parameters:
userName- Name of the user whose credentials we want.- Throws:
StandardException- Thrown on failure
-
dropUser
public void dropUser(java.lang.String userName, TransactionController tc) throws StandardExceptionDescription copied from interface:DataDictionaryDrop a User from the DataDictionary- Specified by:
dropUserin interfaceDataDictionary- Parameters:
userName- The user to drop.tc- The TransactionController- Throws:
StandardException- Thrown on failure
-
resetDatabaseOwner
public void resetDatabaseOwner(TransactionController tc) throws StandardException
Reset the database owner according to what is stored in the catalogs. This can change at upgrade time so we have factored this logic into a separately callable method.- Parameters:
tc- TransactionController- Throws:
StandardException- Thrown on error
-
upgradeFixSystemColumnDefinition
public void upgradeFixSystemColumnDefinition(CatalogRowFactory rowFactory, int columnNumber, TransactionController tc) throws StandardException
Upgrade an existing system catalog column's definition by setting it to the value it would have in a newly created database. This is only used to for a couple of columns that had incorrectly nullability. Other uses (e.g. changing column type) might require more work.- Parameters:
columnNumber- The column to changetc- Transaction controller- Throws:
StandardException- Standard Derby error policy
-
upgrade_addColumns
public void upgrade_addColumns(CatalogRowFactory rowFactory, int[] newColumnIDs, TransactionController tc) throws StandardException
Upgrade an existing catalog by adding columns.- Parameters:
rowFactory- Associated with this catalog.newColumnIDs- Array of 1-based column ids.tc- Transaction controller- Throws:
StandardException- Standard Derby error policy
-
upgrade_addInvisibleColumns
public void upgrade_addInvisibleColumns(CatalogRowFactory rowFactory, int[] newColumnIDs, TransactionController tc) throws StandardException
Add invisible columns to an existing system catalog- Parameters:
rowFactory- Associated with this catalog.newColumnIDs- Array of 1-based column ids.tc- Transaction controller- Throws:
StandardException- Standard Derby error policy
-
computeAutoincRowLocations
public RowLocation[] computeAutoincRowLocations(TransactionController tc, TableDescriptor td) throws StandardException
Description copied from interface:DataDictionaryreturns 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.- Specified by:
computeAutoincRowLocationsin interfaceDataDictionary- 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- See Also:
DataDictionary.computeAutoincRowLocations(org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.sql.dictionary.TableDescriptor)
-
getSetAutoincrementValue
public NumberDataValue getSetAutoincrementValue(RowLocation rl, TransactionController tc, boolean doUpdate, NumberDataValue newValue, boolean wait) throws StandardException
Description copied from interface:DataDictionarygetSetAutoincrementValue 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.- Specified by:
getSetAutoincrementValuein interfaceDataDictionary- 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- See Also:
DataDictionary.getSetAutoincrementValue(org.apache.derby.iapi.types.RowLocation, org.apache.derby.iapi.store.access.TransactionController, boolean, org.apache.derby.iapi.types.NumberDataValue, boolean)
-
clearCaches
public void clearCaches() throws StandardExceptionClear all of the DataDictionary caches.- Specified by:
clearCachesin interfaceDataDictionary- Throws:
StandardException- Standard Derby error policy
-
clearCaches
public void clearCaches(boolean clearSequenceCaches) throws StandardExceptionClear the DataDictionary caches, including the sequence caches if requested..- Specified by:
clearCachesin interfaceDataDictionary- Throws:
StandardException- Standard Derby error policy
-
clearSequenceCaches
public void clearSequenceCaches() throws StandardExceptionFlush sequence caches to disk so that we don't leak unused, pre-allocated numbers.- Specified by:
clearSequenceCachesin interfaceDataDictionary- Throws:
StandardException- Standard Derby error policy
-
initializeCatalogInfo
public void initializeCatalogInfo() throws StandardExceptionInitialize catalog information. This method is overridden by children.- Throws:
StandardException- Thrown on error
-
getTransactionCompile
public TransactionController getTransactionCompile() throws StandardException
Get the TransactionController to use, when not passed in as a parameter. (This hides logic about whether or not we're at boot time in a single place. NOTE: There's no LCC at boot time.) NOTE: Allmethods in the DD should call this method. - Returns:
- TransactionController The TC to use.
- Throws:
StandardException- Thrown on error
-
getTransactionExecute
public TransactionController getTransactionExecute() throws StandardException
Get the TransactionController to use, when not passed in as a parameter. (This hides logic about whether or not we're at boot time in a single place. NOTE: There's no LCC at boot time.) NOTE: Allmethods in the DD should call this method. - Returns:
- TransactionController The TC to use.
- Throws:
StandardException- Thrown on error
-
getIndexRowFromHeapRow
public static ExecIndexRow getIndexRowFromHeapRow(IndexRowGenerator irg, RowLocation rl, ExecRow heapRow) throws StandardException
Get an index row based on a row from the heap.- Parameters:
irg- IndexRowGenerator to userl- RowLocation for heapheapRow- Row from the heap- Returns:
- ExecIndexRow Index row.
- Throws:
StandardException- Thrown on error
-
getEngineType
public int getEngineType()
- Specified by:
getEngineTypein interfaceDataDictionary
-
getSYSCOLUMNSHeapConglomerateNumber
public long getSYSCOLUMNSHeapConglomerateNumber()
Get the heap conglomerate number for SYS.SYSCOLUMNS. (Useful for adding new index to the table.)- Returns:
- The heap conglomerate number for SYS.SYSCOLUMNS.
-
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 The number at the end is to handle more than one system generated name request came at the same time. In that case, the timestamp will remain the same, we will just increment n at the end of the name. Following is how we get around the problem of more than 10 system generated name requestes at the same time: When the database boots up, we start a counter with value -1 for the last digit in the generated name. We also keep the time in millisec to keep track of when the last system name was generated. At the boot time, it will be default to 0L. In addition, we have a calendar object for the time in millisec That calendar object is used to fetch yy, mm, dd, etc for the string SQLyymmddhhmmssxxn When the first request for the system generated name comes, time of last system generated name will be less than the current time. We initialize the counter to 0, set the time of last system generated name to the current time truncated off to lower 10ms time. The first name request is the only time we know for sure the time of last system generated name will be less than the current time. After this first request, the next request could be at any time. We go through the following algorithm for every generated name request. First check if the current time(truncated off to lower 10ms) is greater than the timestamp for last system generated name If yes, then we change the timestamp for system generated name to the current timestamp and reset the counter to 0 and generate the name using the current timestamp and 0 as the number at the end of the generated name. If no, then it means this request for generated name has come at the same time as last one. Or it may come at a time less than the last generated name request. This could be because of seasonal time change or somebody manually changing the time on the computer. In any case, if the counter is less than 10(meaning this is not yet our 11th request for generated name at a given time), we use that in the generated name. But if the counter has reached 10(which means, this is the 11th name request at the same time), then we increment the system generated name timestamp by 10ms and reset the counter to 0 (notice, at this point, the timestamp for system generated names is not in sync with the real current time, but we need to have this mechanism to get around the problem of more than 10 generated name requests at a same physical time).- Specified by:
getSystemSQLNamein interfaceDataDictionary- Returns:
- system generated unique name
-
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.- Specified by:
setAutoincrementValuein interfaceDataDictionary- Parameters:
tc- Transaction Controller to use.columnName- Name of the column.aiValue- Value to write to SYSCOLUMNS.incrementNeeded- whether to increment the value passed in by the user (aiValue) or not before writing it to SYSCOLUMNS.tableUUID- Table Descriptor- Throws:
StandardException
-
computeSequenceRowLocation
public void computeSequenceRowLocation(TransactionController tc, java.lang.String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) throws StandardException
Computes the RowLocation in SYSSEQUENCES for a particular sequence. Also constructs the sequence descriptor.- Specified by:
computeSequenceRowLocationin interfaceDataDictionary- 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
public boolean updateCurrentSequenceValue(TransactionController tc, RowLocation rowLocation, boolean wait, java.lang.Long oldValue, java.lang.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.- Specified by:
updateCurrentSequenceValuein interfaceDataDictionary- 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
public void getCurrentValueAndAdvance(java.lang.String sequenceUUIDstring, NumberDataValue returnValue) throws StandardExceptionDescription copied from interface:DataDictionaryGet 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.- Specified by:
getCurrentValueAndAdvancein interfaceDataDictionary- 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- See Also:
DataDictionary.getCurrentValueAndAdvance(java.lang.String, org.apache.derby.iapi.types.NumberDataValue)
-
peekAtIdentity
public java.lang.Long peekAtIdentity(java.lang.String schemaName, java.lang.String tableName) throws StandardExceptionDescription copied from interface:DataDictionaryPeek at the next value which will be returned by an identity generator.
- Specified by:
peekAtIdentityin interfaceDataDictionary- Throws:
StandardException
-
peekAtSequence
public java.lang.Long peekAtSequence(java.lang.String schemaName, java.lang.String sequenceName) throws StandardExceptionDescription copied from interface:DataDictionaryPeek at the next value which will be returned by a sequence generator.
- Specified by:
peekAtSequencein interfaceDataDictionary- Throws:
StandardException
-
getBulkInsertCounter
public BulkInsertCounter getBulkInsertCounter(java.lang.String sequenceUUIDString, boolean restart) throws StandardException
Description copied from interface:DataDictionaryGet the identity generator used to support the bulk-insert optimization in InsertResultSet.- Specified by:
getBulkInsertCounterin interfaceDataDictionary- 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
public void flushBulkInsertCounter(java.lang.String sequenceUUIDString, BulkInsertCounter bic) throws StandardExceptionDescription copied from interface:DataDictionaryFlush the updated values of the BulkInsertCounter to disk and to the original, cached SequenceUpdater. This is used for the bulk-insert optimization in InsertResultSet.- Specified by:
flushBulkInsertCounterin interfaceDataDictionary- Parameters:
sequenceUUIDString- UUID of the sequence which backs the identity column.bic- the BulkInsertCounter which generates identities for bulk insert- Throws:
StandardException
-
getRowLocationTemplate
public RowLocation getRowLocationTemplate(LanguageConnectionContext lcc, TableDescriptor td) throws StandardException
- Specified by:
getRowLocationTemplatein interfaceDataDictionary- Throws:
StandardException
-
addTableDescriptorToOtherCache
public void addTableDescriptorToOtherCache(TableDescriptor td, Cacheable c) throws StandardException
Add a table descriptor to the "other" cache. The other cache is determined by the type of the object c.- Parameters:
td- TableDescriptor to add to the other cache.c- Cacheable Object which lets us figure out the other cache.- Throws:
StandardException
-
dropStatisticsDescriptors
public void dropStatisticsDescriptors(UUID tableUUID, UUID referenceUUID, TransactionController tc) throws StandardException
Description copied from interface:DataDictionaryDrops all statistics descriptors for a given table/index column combination. If the index is not specified, then all statistics for the table are dropped.- Specified by:
dropStatisticsDescriptorsin interfaceDataDictionary- Parameters:
tableUUID- UUID of the tablereferenceUUID- UUID of the index. This can be null.tc- Transcation Controller to use.- Throws:
StandardException- See Also:
DataDictionary.dropStatisticsDescriptors(org.apache.derby.catalog.UUID, org.apache.derby.catalog.UUID, org.apache.derby.iapi.store.access.TransactionController)
-
checkVersion
public boolean checkVersion(int requiredMajorVersion, java.lang.String feature) throws StandardExceptionCheck to see if a database has been upgraded to the required level in order to use a language feature.- Specified by:
checkVersionin interfaceDataDictionary- Parameters:
requiredMajorVersion- Data Dictionary major versionfeature- 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
public boolean isReadOnlyUpgrade()
Description copied from interface:DataDictionaryCheck if the database is read only and requires some form of upgrade that makes the stored prepared statements invalid.- Specified by:
isReadOnlyUpgradein interfaceDataDictionary- Returns:
trueif the stored prepared statements are invalid because of an upgrade and the database is read only,falseotherwise
-
grantPublicAccessToSystemRoutines
public void grantPublicAccessToSystemRoutines(java.util.HashSet newlyCreatedRoutines, TransactionController tc, java.lang.String authorizationID) throws StandardExceptionGrant PUBLIC access to specific system routines. Currently, this is done for some routines in SYSCS_UTIL schema. We grant access to routines which we have just added. Doing it this way lets us declare these routines in one place and re-use this logic during database creation and during upgrade.- Parameters:
tc- TransactionController to useauthorizationID- authorization ID of the permission grantor- Throws:
StandardException- Standard exception policy.
-
run
public final java.util.Properties run()
- Specified by:
runin interfacejava.security.PrivilegedAction<java.util.Properties>
-
getTablePermissions
public TablePermsDescriptor getTablePermissions(UUID tableUUID, java.lang.String authorizationId) throws StandardException
Get one user's privileges on a table- Specified by:
getTablePermissionsin interfaceDataDictionary- Parameters:
tableUUID-authorizationId- The user name- Returns:
- a TablePermsDescriptor or null if the user has no permissions on the table.
- Throws:
StandardException
-
getTablePermissions
public TablePermsDescriptor getTablePermissions(UUID tablePermsUUID) throws StandardException
Description copied from interface:DataDictionaryGet one user's privileges on a table using tablePermsUUID- Specified by:
getTablePermissionsin interfaceDataDictionary- Returns:
- a TablePermsDescriptor
- Throws:
StandardException
-
getColumnPermissions
public ColPermsDescriptor getColumnPermissions(UUID colPermsUUID) throws StandardException
Description copied from interface:DataDictionaryGet one user's column privileges on a table using colPermsUUID- Specified by:
getColumnPermissionsin interfaceDataDictionary- Returns:
- a ColPermsDescriptor
- Throws:
StandardException
-
getColumnPermissions
public ColPermsDescriptor getColumnPermissions(UUID tableUUID, int privType, boolean forGrant, java.lang.String authorizationId) throws StandardException
Get one user's column privileges for a table.- Specified by:
getColumnPermissionsin interfaceDataDictionary- Parameters:
tableUUID-privType- (as int) 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
public ColPermsDescriptor getColumnPermissions(UUID tableUUID, java.lang.String privTypeStr, boolean forGrant, java.lang.String authorizationId) throws StandardException
Get one user's column privileges for a table. This routine gets called during revoke privilege processing- Specified by:
getColumnPermissionsin interfaceDataDictionary- 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
-
getRoutinePermissions
public RoutinePermsDescriptor getRoutinePermissions(UUID routineUUID, java.lang.String authorizationId) throws StandardException
Get one user's permissions for a routine (function or procedure).- Specified by:
getRoutinePermissionsin interfaceDataDictionary- Parameters:
routineUUID-authorizationId- The user's name- Returns:
- The descriptor of the users permissions for the routine.
- Throws:
StandardException
-
getRoutinePermissions
public RoutinePermsDescriptor getRoutinePermissions(UUID routinePermsUUID) throws StandardException
Description copied from interface:DataDictionaryGet one user's privileges for a routine using routinePermsUUID- Specified by:
getRoutinePermissionsin interfaceDataDictionary- Returns:
- a RoutinePermsDescriptor
- Throws:
StandardException
-
addRemovePermissionsDescriptor
public boolean addRemovePermissionsDescriptor(boolean add, PermissionsDescriptor perm, java.lang.String grantee, TransactionController tc) throws StandardExceptionAdd or remove a permission to/from the permission database.- Specified by:
addRemovePermissionsDescriptorin interfaceDataDictionary- Parameters:
add- if true then the permission is added, if false the permission is removedperm-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
-
getVTIClass
public java.lang.String getVTIClass(TableDescriptor td, boolean asTableFunction) throws StandardException
Description copied from interface:DataDictionaryReturn 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".- Specified by:
getVTIClassin interfaceDataDictionary- 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- See Also:
DataDictionary.getVTIClass(TableDescriptor, boolean)
-
getBuiltinVTIClass
public java.lang.String getBuiltinVTIClass(TableDescriptor td, boolean asTableFunction) throws StandardException
Description copied from interface:DataDictionaryReturn the Java class to use for a builtin VTI to which the received table descriptor maps.- Specified by:
getBuiltinVTIClassin interfaceDataDictionary- 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- See Also:
DataDictionary.getBuiltinVTIClass(TableDescriptor, boolean)
-
getRoleGrantDescriptor
public RoleGrantDescriptor getRoleGrantDescriptor(UUID uuid) throws StandardException
Description copied from interface:DataDictionaryGet the role grant descriptor corresponding to the uuid provided- Specified by:
getRoleGrantDescriptorin interfaceDataDictionary- Returns:
- The descriptor for the role grant descriptor
- Throws:
StandardException- Thrown on error- See Also:
DataDictionary.getRoleGrantDescriptor(UUID)
-
getRoleDefinitionDescriptor
public RoleGrantDescriptor getRoleDefinitionDescriptor(java.lang.String roleName) throws StandardException
Get the target role definition by searching for a matching row in SYSROLES by rolename where isDef==true. Read only scan. Uses index on (rolename, isDef) columns.- Specified by:
getRoleDefinitionDescriptorin interfaceDataDictionary- Parameters:
roleName- The name of the role we're interested in.- Returns:
- The descriptor (row) for the role
- Throws:
StandardException- Thrown on error- See Also:
DataDictionary.getRoleDefinitionDescriptor(java.lang.String)
-
getRoleGrantDescriptor
public RoleGrantDescriptor getRoleGrantDescriptor(java.lang.String roleName, java.lang.String grantee, java.lang.String grantor) throws StandardException
Get the target role by searching for a matching row in SYSROLES by rolename, grantee and grantor. Read only scan. Uses index on roleid, grantee and grantor columns.- Specified by:
getRoleGrantDescriptorin interfaceDataDictionary- Parameters:
roleName- The name of the role we're interested in.grantee- The granteegrantor- The grantor- Returns:
- The descriptor for the role grant
- Throws:
StandardException- Thrown on error- See Also:
DataDictionary.getRoleGrantDescriptor(String, String, String)
-
existsGrantToAuthid
public boolean existsGrantToAuthid(java.lang.String authId, TransactionController tc) throws StandardExceptionCheck all dictionary tables and return true if there is any GRANT descriptor containingauthIdas its grantee.- Specified by:
existsGrantToAuthidin interfaceDataDictionary- 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
public void updateMetadataSPSes(TransactionController tc) throws StandardException
Drop and recreate metadata stored prepared statements.- Specified by:
updateMetadataSPSesin interfaceDataDictionary- Parameters:
tc- the xact- Throws:
StandardException
-
dropSequenceDescriptor
public void dropSequenceDescriptor(SequenceDescriptor descriptor, TransactionController tc) throws StandardException
Drops a sequence descriptor- Specified by:
dropSequenceDescriptorin interfaceDataDictionary- Parameters:
descriptor- The descriptor to droptc- The TransactionController.- Throws:
StandardException- Thrown on failure
-
getSequenceDescriptor
public SequenceDescriptor getSequenceDescriptor(UUID uuid) throws StandardException
Description copied from interface:DataDictionaryget a descriptor for a Sequence by uuid- Specified by:
getSequenceDescriptorin interfaceDataDictionary- Parameters:
uuid- uuid of the sequence- Returns:
- the SequenceDescriptor
- Throws:
StandardException- error
-
getSequenceDescriptor
public SequenceDescriptor getSequenceDescriptor(SchemaDescriptor sd, java.lang.String sequenceName) throws StandardException
Get the sequence descriptor given a sequence name and a schema Id.- Specified by:
getSequenceDescriptorin interfaceDataDictionary- Parameters:
sequenceName- The sequence name, guaranteed to be unique only within its schema.sd- The schema descriptor.- Returns:
- The SequenceDescriptor for the constraints.
- Throws:
StandardException- Thrown on failure
-
getGenericPermissions
public PermDescriptor getGenericPermissions(UUID objectUUID, java.lang.String objectType, java.lang.String privilege, java.lang.String granteeAuthId) throws StandardException
Get permissions granted to one user for an object using the object's Id and the user's authorization Id.- Specified by:
getGenericPermissionsin interfaceDataDictionary- Parameters:
objectUUID- The id of the protected objectobjectType- Type of the object (e.g., SEQUENCE)privilege- The kind of privilege needed (e.g., PermDescriptor.USAGE_PRIV)granteeAuthId- The user or role who wants to have permission on this object- Returns:
- The descriptor of the permissions for the object
- Throws:
StandardException
-
getGenericPermissions
public PermDescriptor getGenericPermissions(UUID permUUID) throws StandardException
Get one user's privileges for an object using the permUUID.- Specified by:
getGenericPermissionsin interfaceDataDictionary- Parameters:
permUUID-- Returns:
- The descriptor of the user's permissions for the object.
- Throws:
StandardException
-
dropAllPermDescriptors
public void dropAllPermDescriptors(UUID objectID, TransactionController tc) throws StandardException
Drops all permission descriptors for the object whose Id is given.- Specified by:
dropAllPermDescriptorsin interfaceDataDictionary- Parameters:
objectID- The UUID of the object from which to drop all the permission descriptorstc- TransactionController for the transaction- Throws:
StandardException- Thrown on error
-
getIndexStatsRefresher
public IndexStatisticsDaemon getIndexStatsRefresher(boolean asDaemon)
Returns the index statistics refresher.- Specified by:
getIndexStatsRefresherin interfaceDataDictionary- Parameters:
asDaemon- whether the usage is automatic (true) or explicit (false)- Returns:
- The index statistics refresher instance, or
nullif disabled. IfasDaemonisfalse, an instance will always be returned.
-
disableIndexStatsRefresher
public 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.
- Specified by:
disableIndexStatsRefresherin interfaceDataDictionary
-
doCreateIndexStatsRefresher
public 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.
- Specified by:
doCreateIndexStatsRefresherin interfaceDataDictionary- Returns:
trueif an index statistics refresher should be created,falseif one already exists.
-
createIndexStatsRefresher
public void createIndexStatsRefresher(Database db, java.lang.String dbName)
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).
- Specified by:
createIndexStatsRefresherin interfaceDataDictionary- Parameters:
db- the database object associated with this data dictionarydbName- the name of the database
-
getDependableFinder
public DependableFinder getDependableFinder(int formatId)
Description copied from interface:DataDictionaryGet aDependableFinderinstance.- Specified by:
getDependableFinderin interfaceDataDictionary- Parameters:
formatId- the format id- Returns:
- an instance capable of finding
Dependables with the specified format id
-
getColumnDependableFinder
public DependableFinder getColumnDependableFinder(int formatId, byte[] columnBitMap)
Description copied from interface:DataDictionaryGet aDependableFinderinstance for referenced columns in a table.- Specified by:
getColumnDependableFinderin interfaceDataDictionary- Parameters:
formatId- the format idcolumnBitMap- byte array encoding the bitmap of referenced columns- Returns:
- an instance capable of finding
Dependables with the specified format id
-
-
DataMelt 3.0 © DataMelt by jWork.ORG