Class DataDictionaryImpl
- All Implemented Interfaces:
PrivilegedAction<Properties>
,CacheableFactory
,ModuleControl
,ModuleSupportable
,DataDictionary
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) AccessFactory
private String
protected boolean
private TransactionController
(package private) ShExLockable
(package private) int
private GregorianCalendar
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private int
Collation Type for SYSTEM schemas.private int
Collation Type for user schemas.private static final String[]
private static final String[]
private TabInfoImpl[]
(package private) int
private SchemaDescriptor
private String[][]
private String[][]
private DD_Version
Dictionary version of the on-disk databaseprotected DependencyManager
(package private) static final int
Possible action for visitPermsByGrantee and visitRoleGrants.private DataValueFactory
(package private) int
private ExecutionFactory
(package private) static final int
Possible action for visitPermsByGrantee and visitRoleGrants.private IndexStatisticsDaemon
Daemon creating and refreshing index cardinality statistics.private boolean
Tells if the automatic index statistics refresher has been disabled.private boolean
private String
(package private) CacheManager
private TabInfoImpl[]
private static final String[]
private static final int
private static final int
(package private) CacheManager
(package private) CacheManager
(package private) int
(package private) int
private boolean
True if the database is read only and requires some form of upgrade, that makes the stored prepared statements invalid.private int
private CacheManager
private DD_Version
Dictionary version of the currently running engineprivate Hashtable
<UUID, SPSDescriptor> private CacheManager
private String
(package private) Properties
(package private) int
private static final int
private static final int
private static final int
Index into SYSFUN_FUNCTIONS of the DETERMINISTIC indicator.private static final int
The index of the first parameter in entries in the SYSFUN_FUNCTIONS table.private static final String[][]
SYSFUN functions.private static final int
Index into SYSFUN_FUNCTIONS of the VARARGS indicator.private final AliasDescriptor[]
Runtime definition of the functions from SYSFUN_FUNCTIONS.private SchemaDescriptor
private static final int
private static final int
private SchemaDescriptor
private static final String[]
List of all "system" schemasprivate int
private SchemaDescriptor
private static final String[]
List of functions in SYSCS_UTIL schema with PUBLIC accessprivate static final String[]
List of procedures in SYSCS_UTIL schema with PUBLIC access(package private) int
private long
private boolean
protected UUIDFactory
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_12, DD_VERSION_DERBY_10_13, DD_VERSION_DERBY_10_14, 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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
activeConstraint
(ConstraintDescriptor constraint) Reports whether an individual constraint must be enforced.void
addConstraintDescriptor
(ConstraintDescriptor descriptor, TransactionController tc) Adds the given ConstraintDescriptor to the data dictionary, associated with the given table and constraint type.void
addDescriptor
(TupleDescriptor td, TupleDescriptor parent, int catalogNumber, boolean duplicatesAllowed, TransactionController tc) Adds a descriptor to a system catalog identified by the catalogNumber.void
addDescriptorArray
(TupleDescriptor[] td, TupleDescriptor parent, int catalogNumber, boolean allowDuplicates, TransactionController tc) array version of addDescriptor.boolean
addRemovePermissionsDescriptor
(boolean add, PermissionsDescriptor perm, String grantee, TransactionController tc) Add or remove a permission to/from the permission database.void
addSPSDescriptor
(SPSDescriptor descriptor, TransactionController tc) Adds the given SPSDescriptor to the data dictionary, associated with the given table and constraint type.private void
addSPSParams
(SPSDescriptor spsd, TransactionController tc) Add a column in SYS.SYSCOLUMNS for each parameter in the parameter list.private void
addSubKeyConstraint
(KeyConstraintDescriptor descriptor, TransactionController tc) Add the matching row to syskeys when adding a unique or primary key constraint(package private) void
addSYSCOLUMNSIndex2Property
(TransactionController tc, long index2ConglomerateNumber) private SchemaDescriptor
addSystemSchema
(String schema_name, String schema_uuid, TransactionController tc) Add a system schema to the database.private void
addSystemTableToDictionary
(TabInfoImpl ti, SchemaDescriptor sd, TransactionController tc, DataDescriptorGenerator ddg) Add the required entries to the data dictionary for a System table.void
Add a table descriptor to the "other" cache.void
boot
(boolean create, Properties startParams) Start-up method for this instance of the data dictionary.private static Object
bootServiceModule
(boolean create, Object serviceModule, String factoryInterface, Properties properties) Privileged startup.private ConglomerateDescriptor
bootstrapOneIndex
(SchemaDescriptor sd, TransactionController tc, DataDescriptorGenerator ddg, TabInfoImpl ti, int indexNumber, long heapConglomerateNumber) private void
bootStrapSystemIndexes
(SchemaDescriptor sd, TransactionController tc, DataDescriptorGenerator ddg, TabInfoImpl ti) Infrastructure work for indexes on catalogs.boolean
canSupport
(Properties startParams) This is the data dictionary implementation for the standard database engine.private void
checkInvalidTriggerReference
(String tableName, String oldReferencingName, String newReferencingName, int triggerEventMask) boolean
checkVersion
(int requiredMajorVersion, String feature) Check to see if a database has been upgraded to the required level in order to use a language feature.void
Clear all of the DataDictionary caches.void
clearCaches
(boolean clearSequenceCaches) Clear the DataDictionary caches, including the sequence caches if requested..private void
clearNoncoreTable
(int nonCoreNum) void
Flush sequence caches to disk so that we don't leak unused, pre-allocated numbers.(package private) void
Mark all SPS plans in the data dictionary invalid.returns an array of RowLocations corresponding to the autoincrement columns in the table.private RowLocation
computeRowLocation
(TransactionController tc, TableDescriptor td, String columnName) Computes the RowLocation in SYSCOLUMNS for a particular autoincrement column.void
computeSequenceRowLocation
(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) Computes the RowLocation in SYSSEQUENCES for a particular sequence.(package private) void
create_10_1_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines, UUID sysUtilUUID) Create system procedures added in version 10.1.(package private) void
create_10_10_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.10.(package private) void
create_10_11_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.11.(package private) void
create_10_12_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.12.(package private) void
create_10_13_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.13.(package private) void
create_10_2_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines, UUID sysUtilUUID) Create system procedures added in version 10.2.(package private) void
create_10_3_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create the System procedures that are added in 10.3.(package private) void
create_10_3_system_procedures_SYSCS_UTIL
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures that are part of the SYSCS_UTIL schema added in version 10.3.private void
create_10_3_system_procedures_SYSIBM
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures added in version 10.3.(package private) void
create_10_5_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create the System procedures that are added to 10.5.(package private) void
create_10_6_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create the System procedures that are added to 10.6.(package private) void
create_10_9_system_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures that are part of the SYSCS_UTIL schema added in version 10.9.private final void
create_SYSCS_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system proceduresprotected final void
create_SYSIBM_procedures
(TransactionController tc, HashSet<String> newlyCreatedRoutines) Create system procedures in SYSIBMprivate long
createConglomerate
(String name, TransactionController tc, ExecRow rowTemplate, Properties properties) Create a conglomerate for a system tableprotected void
createDictionaryTables
(Properties params, TransactionController tc, DataDescriptorGenerator ddg) Create all the required dictionary tables.private void
Create a sequence generator for an identity column on upgrade to 10.11.(package private) void
Create sequence generators for all identity columns on upgrade to 10.11.void
createIndexStatsRefresher
(Database db, String dbName) Creates an index statistics refresher for this data dictionary.createRoleClosureIterator
(TransactionController tc, String role, boolean inverse) This method creates a new iterator over the closure of role grants starting or ending with a given role.(package private) void
createRoutinePermPublicDescriptor
(UUID routineUUID, TransactionController tc, String authorizationID) Create RoutinePermDescriptor to grant access to PUBLIC for this system routine using the grantor specified in authorizationID.protected void
createSPSSet
(TransactionController tc, boolean net, UUID schemaID) Create a set of stored prepared statements from a properties file.private final UUID
createSystemProcedureOrFunction
(String routine_name, UUID schema_uuid, String[] arg_names, TypeDescriptor[] arg_types, int num_out_param, int num_result_sets, short routine_sql_control, boolean isDeterministic, boolean hasVarargs, TypeDescriptor return_type, HashSet<String> newlyCreatedRoutines, TransactionController tc) Generic create procedure routine.private final UUID
createSystemProcedureOrFunction
(String routine_name, UUID schema_uuid, String[] arg_names, TypeDescriptor[] arg_types, int num_out_param, int num_result_sets, short routine_sql_control, boolean isDeterministic, boolean hasVarargs, TypeDescriptor return_type, HashSet<String> newlyCreatedRoutines, TransactionController tc, String procClass) Generic create procedure routine.(package private) void
Create system built-in metadata stored prepared statements.private void
debugGenerateInfo
(StringBuffer strbuf, TransactionController tc, ConglomerateController heapCC, TabInfoImpl ti, int indexId) void
Disables automatic refresh/creation of index statistics at runtime.boolean
Tells if an index statistics refresher should be created for this database.void
doneReading
(int mode, LanguageConnectionContext lcc) Inform this DataDictionary that we have finished reading it.void
Drop a AliasDescriptor from the DataDictionaryvoid
dropAllColumnDescriptors
(UUID tableID, TransactionController tc) Drops all column descriptors from the given table.void
Drops all conglomerates associated with a table.void
Drops all ConstraintDescriptors from the data dictionary that are associated with the given table,void
dropAllPermDescriptors
(UUID objectID, TransactionController tc) Drops all permission descriptors for the object whose Id is given.void
dropAllPermsByGrantee
(String authId, TransactionController tc) Drop all permission descriptors corresponding to a grant to the named authentication identifiervoid
dropAllRoutinePermDescriptors
(UUID routineID, TransactionController tc) Drops all routine permission descriptors for the given routine.void
dropAllTableAndColPermDescriptors
(UUID tableID, TransactionController tc) Drops all table and column permission descriptors for the given table.void
dropColumnDescriptor
(UUID tableID, String columnName, TransactionController tc) Given a column name and a table ID, drops the column descriptor from the table.private void
Delete the appropriate rows from syscolumns when dropping 1 or more columns.private void
Delete the appropriate rows from syscolperms when dropping a tablevoid
dropConglomerateDescriptor
(ConglomerateDescriptor conglomerate, TransactionController tc) Drops a conglomerate descriptorvoid
dropConstraintDescriptor
(ConstraintDescriptor descriptor, TransactionController tc) Drops the given ConstraintDescriptor from the data dictionary.void
dropDependentsStoredDependencies
(UUID dependentsUUID, TransactionController tc) Remove all of the stored dependencies for a given dependent's ID from the data dictionary.void
dropDependentsStoredDependencies
(UUID dependentsUUID, TransactionController tc, boolean wait) Remove all of the stored dependencies for a given dependent's ID from the data dictionary.void
Drop a FileDescriptor from the datadictionary.private void
Remove metadata stored prepared statements.private void
dropPermsByGrantee
(String authId, TransactionController tc, int catalog, int indexNo, int granteeColnoInIndex) Presently only used when dropping roles - user dropping is not under Derby control (well, built-in users are if properties are stored in database), any permissions granted to users remain in place even if the user is no more.void
dropRoleGrant
(String roleName, String grantee, String grantor, TransactionController tc) Drop a role grantvoid
dropRoleGrantsByGrantee
(String grantee, TransactionController tc) Drop all role grants corresponding to a grant of (any) role to a named authentication identifiervoid
dropRoleGrantsByName
(String roleName, TransactionController tc) Drop all role grants corresponding to a grant of the named role to any authentication identifiervoid
dropSchemaDescriptor
(String schemaName, TransactionController tc) Drop the descriptor for a schema, given the schema's namevoid
dropSequenceDescriptor
(SequenceDescriptor descriptor, TransactionController tc) Drops a sequence descriptorprivate void
Drop a sequenceID from the ( schemaName, sequenceName ) mapvoid
dropSPSDescriptor
(UUID uuid, TransactionController tc) Drops the given SPSDescriptor.void
dropSPSDescriptor
(SPSDescriptor descriptor, TransactionController tc) Drops the given SPSDescriptor.void
dropStatisticsDescriptors
(UUID tableUUID, UUID referenceUUID, TransactionController tc) Drops all statistics descriptors for a given table/index column combination.void
Drop a single dependency from the data dictionary.private void
dropSubCheckConstraint
(UUID constraintId, TransactionController tc) Drop the matching row from syschecks when dropping a check constraint.private void
dropSubKeyConstraint
(ConstraintDescriptor constraint, TransactionController tc) Drop the matching row from syskeys when dropping a primary key or unique constraint.void
dropTableDescriptor
(TableDescriptor td, SchemaDescriptor schema, TransactionController tc) Drop the table descriptor.private void
dropTablePermDescriptor
(TransactionController tc, ExecIndexRow keyRow) Delete the appropriate rows from systableperms when dropping a tablevoid
dropTriggerDescriptor
(TriggerDescriptor descriptor, TransactionController tc) Drops the given TriggerDescriptor.void
dropUser
(String userName, TransactionController tc) Drop a User from the DataDictionaryvoid
Drops the view descriptor from the data dictionary.private StandardException
duplicateDescriptorException
(TupleDescriptor tuple, TupleDescriptor parent) int[]
examineTriggerNodeAndCols
(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements) 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().boolean
existsGrantToAuthid
(String authId, TransactionController tc) Check all dictionary tables and return true if there is any GRANT descriptor containingauthId
as its grantee.private boolean
existsPermByGrantee
(String authId, TransactionController tc, int catalog, int indexNo, int granteeColnoInIndex) Return true if there exists a permission grant descriptor to this authorization id.private boolean
existsRoleGrantByGrantee
(String grantee, TransactionController tc) Return true if there exists a role grant to authorization identifier.boolean
existsSchemaOwnedBy
(String authid, TransactionController tc) Return true of there exists a schema whose authorizationId equals authid, i.e.private void
Finishes building a TabInfoImpl if it hasn't already been faulted in.private String
Find the default message digest algorithm to use for BUILTIN authentication on this database.private static Object
findServiceModule
(Object serviceModule, String factoryInterface) Privileged startup.private TableDescriptor
Finish filling in the TableDescriptor.void
flushBulkInsertCounter
(String sequenceUUIDString, BulkInsertCounter bic) Flush the updated values of the BulkInsertCounter to disk and to the original, cached SequenceUpdater.private String
genColumnReferenceSQL
(TableDescriptor td, String colName, String tabName, boolean isOldTable, int colPositionInRuntimeResultSet) private byte[]
generateRandomSalt
(Dictionary props) Generate an array of random bytes to use as salt when hashing credentials.Convert a constraint descriptor list into a list of active constraints, that is, constraints which must be enforced.getAliasDescriptor
(String schemaId, String aliasName, char nameSpace) Get a AliasDescriptor by alias name and name space.getAliasDescriptor
(UUID uuid) Get a AliasDescriptor given its UUID.Get the alias descriptor for an ANSI UDT.private ConstraintDescriptorList
Get every constraint in this database.Build and return an List with DependencyDescriptors for all of the stored dependencies.Get every statement in this database.Get authorizationID of Database Ownerprivate long
getBootParameter
(Properties startParams, String key, boolean required) private void
Set up the builtin schema descriptors for system schemas.getBuiltinVTIClass
(TableDescriptor td, boolean asTableFunction) Return the Java class to use for a builtin VTI to which the received table descriptor maps.getBulkInsertCounter
(String sequenceUUIDString, boolean restart) Get the identity generator used to support the bulk-insert optimization in InsertResultSet.int
Returns the cache mode of the data dictionary.int
Return the collation type for SYSTEM schemas.int
Return the collation type for user schemas.getColumnDependableFinder
(int formatId, byte[] columnBitMap) Get aDependableFinder
instance for referenced columns in a table.Get a ColumnDescriptor given its Default ID.private void
getColumnDescriptorsScan
(UUID uuid, ColumnDescriptorList cdl, TupleDescriptor td) Populate the ColumnDescriptorList for the specified TableDescriptor.private void
Populate the ColumnDescriptorList for the specified TableDescriptor.getColumnPermissions
(UUID colPermsUUID) Get one user's column privileges on a table using colPermsUUIDgetColumnPermissions
(UUID tableUUID, int privType, boolean forGrant, String authorizationId) Get one user's column privileges for a table.getColumnPermissions
(UUID tableUUID, String privTypeStr, boolean forGrant, String authorizationId) Get one user's column privileges for a table.getConglomerateDescriptor
(long conglomerateNumber) Get a ConglomerateDescriptor given its conglomerate number.getConglomerateDescriptor
(String indexName, SchemaDescriptor sd, boolean forUpdate) Gets a conglomerate descriptor for the named index in the given schema, getting an exclusive row lock on the matching row in sys.sysconglomerates (for DDL concurrency) if requested.Get a ConglomerateDescriptor given its UUID.getConglomerateDescriptors
(long conglomerateNumber) Get an array of conglomerate descriptors for the given conglomerate number.Get an array of ConglomerateDescriptors given the UUID.private void
Populate the ConglomerateDescriptorList for the specified TableDescriptor by scanning sysconglomerates.getConstraintDescriptor
(String constraintName, UUID schemaID) Get a ConstraintDescriptor given its name and schema ID.getConstraintDescriptor
(UUID uuid) Get a ConstraintDescriptor given its UUID.getConstraintDescriptor
(TableDescriptor td, UUID uuid) Get the constraint descriptor given a table and the UUID String of the backing index.getConstraintDescriptorById
(TableDescriptor td, UUID uuid) Get the constraint descriptor given a table and the UUID String of the constraintgetConstraintDescriptorByName
(TableDescriptor td, SchemaDescriptor sd, String constraintName, boolean forUpdate) Get the constraint descriptor given a TableDescriptor and the constraint name.Load up the constraint descriptor list for this table descriptor and return it.private void
getConstraintDescriptorsScan
(TableDescriptor td, boolean forUpdate) Populate the ConstraintDescriptorList for the specified TableDescriptor.protected TupleDescriptor
getConstraintDescriptorViaHeap
(ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, ConstraintDescriptorList list) Return a (single or list of) catalog row descriptor(s) from SYSCONSTRAINTS through a heap scanprotected ConstraintDescriptor
getConstraintDescriptorViaIndex
(int indexId, ExecIndexRow keyRow, TabInfoImpl ti, TableDescriptor td, ConstraintDescriptorList dList, boolean forUpdate) Return a (single or list of) ConstraintDescriptor(s) from SYSCONSTRAINTS where the access is from the index to the heap.getConstraints
(UUID uuid, int indexId, int columnNum) Return an List which of the relevant column matching the indexed criteria.getConstraintTableDescriptor
(UUID constraintId) Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passsed in.private static Context
getContext
(String contextID) Privileged lookup of a Context.private static Context
getContextOrNull
(String contextID) Privileged lookup of a Context.private static ContextService
Privileged lookup of the ContextService.void
getCurrentValueAndAdvance
(String sequenceUUIDstring, NumberDataValue returnValue) Get the next number from an ANSI/ISO sequence generator which was created with the CREATE SEQUENCE statement.Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.Get a DataValueFactory, through which we can create data value objects.Get the descriptor for the declared global temporary table schema which is always named "SESSION".getDependableFinder
(int formatId) Get aDependableFinder
instance.returns the dependencymanager associated with this datadictionary.getDependentsDescriptorList
(String dependentID) Gets a list of the dependency descriptors for the given dependent's id.protected <T extends TupleDescriptor>
TgetDescriptorViaHeap
(FormatableBitSet columns, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType) Return a (single or list of) catalog row descriptor(s) from a system table where the access a heap scanprivate <T extends TupleDescriptor>
TgetDescriptorViaIndex
(int indexId, ExecIndexRow keyRow, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType, boolean forUpdate) Return a (single or list of) catalog row descriptor(s) from a system table where the access is from the index to the heap.private <T extends TupleDescriptor>
TgetDescriptorViaIndex
(int indexId, ExecIndexRow keyRow, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType, boolean forUpdate, int isolationLevel, TransactionController tc) Return a (single or list of) catalog row descriptor(s) from a system table where the access is from the index to the heap.private <T extends TupleDescriptor>
TgetDescriptorViaIndexMinion
(int indexId, ExecIndexRow keyRow, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType, boolean forUpdate, int isolationLevel, TransactionController tc) int
Get ExecutionFactory associated with this database.Get a FileInfoDescriptor given its id.getFileInfoDescriptor
(SchemaDescriptor sd, String name) Get a FileInfoDescriptor given its SQL name and schema name.private FileInfoDescriptor
getFileInfoDescriptorIndex1Scan
(UUID schemaId, String name) Scan sysfiles_index1 (schemaid,name) for a match.private FileInfoDescriptor
Scan sysfiles_index2 (id) for a match.getForeignKeys
(UUID constraintId) Return a list of foreign keys constraints referencing this constraint.getGenericPermissions
(UUID permUUID) Get one user's privileges for an object using the permUUID.getGenericPermissions
(UUID objectUUID, String objectType, String privilege, String granteeAuthId) Get permissions granted to one user for an object using the object's Id and the user's authorization Id.private static SQLChar
getIDValueAsCHAR
(UUID uuid) Converts a UUID to an DataValueDescriptor.static ExecIndexRow
getIndexRowFromHeapRow
(IndexRowGenerator irg, RowLocation rl, ExecRow heapRow) Get an index row based on a row from the heap.getIndexStatsRefresher
(boolean asDaemon) Returns the index statistics refresher.private int
getIntProperty
(Dictionary props, String key, int defaultValue, int minValue, int maxValue) Get the value of an integer property.private static LanguageConnectionContext
getLCC()
(package private) static ModuleFactory
Privileged Monitor lookup.private TabInfoImpl
getNonCoreTI
(int catalogNumber) Get a TabInfoImpl for a non-core table.protected TabInfoImpl
getNonCoreTIByNumber
(int catalogNumber) returns the tabinfo for a non core system catalog.private Object
private CacheManager
getProvidersDescriptorList
(String providerID) Gets a list of the dependency descriptors for the given provider's id.private final Properties
getQueryDescriptions
(boolean net) getRoleDefinitionDescriptor
(String roleName) Get the target role definition by searching for a matching row in SYSROLES by rolename where isDef==true.getRoleGrantDescriptor
(String roleName, String grantee, String grantor) Get the target role by searching for a matching row in SYSROLES by rolename, grantee and grantor.getRoleGrantDescriptor
(UUID uuid) Get the role grant descriptor corresponding to the uuid provided(package private) HashMap
<String, List<RoleGrantDescriptor>> getRoleGrantGraph
(TransactionController tc, boolean inverse) Return an in-memory representation of the role grant graph (sans grant of roles to users, only role-role relation.getRoutineList
(String schemaID, String routineName, char nameSpace) Get the list of routines matching the schema and routine name.getRoutinePermissions
(UUID routinePermsUUID) Get one user's privileges for a routine using routinePermsUUIDgetRoutinePermissions
(UUID routineUUID, String authorizationId) Get one user's permissions for a routine (function or procedure).getSchemaDescriptor
(String schemaName, TransactionController tc, boolean raiseError) Get the descriptor for the named schema.getSchemaDescriptor
(UUID schemaId, int isolationLevel, TransactionController tc) Get the SchemaDescriptor for the given schema identifier.getSchemaDescriptor
(UUID schemaId, TransactionController tc) Get the SchemaDescriptor for the given schema identifier.private SchemaDescriptor
getSchemaDescriptorBody
(UUID schemaId, int isolationLevel, TransactionController tc) getSequenceDescriptor
(UUID uuid) get a descriptor for a Sequence by uuidgetSequenceDescriptor
(SchemaDescriptor sd, String sequenceName) Get the sequence descriptor given a sequence name and a schema Id.private String
getSequenceID
(String schemaName, String sequenceName) Get the uuid string of a sequence given its schema and sequence name.getSetAutoincrementValue
(RowLocation rl, TransactionController tc, boolean doUpdate, NumberDataValue newValue, boolean wait) getSetAutoincrementValue fetches the autoincrement value from SYSCOLUMNS given a row location.getSPSDescriptor
(String stmtName, SchemaDescriptor sd) Get a SPSDescriptor given its name.getSPSDescriptor
(UUID uuid) Get a SPSDescriptor given its UUID.private SPSDescriptor
getSPSDescriptorIndex1Scan
(String stmtName, String schemaUUID) Scan sysschemas_index1 (stmtname, schemaid) for a match.private SPSDescriptor
getSPSDescriptorIndex2Scan
(String stmtUUID) Scan sysstatements_index2 (stmtid) for a match.getSPSParams
(SPSDescriptor spsd, List<DataValueDescriptor> defaults) Get all the parameter descriptors for an SPS.Returns all the statistics descriptors for the given table.private SubCheckConstraintDescriptor
getSubCheckConstraint
(UUID constraintId) Get a SubCheckConstraintDescriptor from syschecks for the specified constraint id.getSubKeyConstraint
(UUID constraintId, int type) Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for the specified constraint id.long
Get the heap conglomerate number for SYS.SYSCOLUMNS.Get the descriptor for the SYSIBM schema.Get the descriptor for the system schema.Returns a unique system generated name of the form SQLyymmddhhmmssxxn yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second, xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value, n - number between 0-9 The number at the end is to handle more than one system generated name request came at the same time.Get the descriptor for the SYSCS_UTIL system schema.getTableDescriptor
(String tableName, SchemaDescriptor schema, TransactionController tc) Get the descriptor for the named table within the given schema.getTableDescriptor
(UUID tableID) Get the descriptor for the table with the given UUID.private TableDescriptor
getTableDescriptorIndex1Scan
(String tableName, String schemaUUID) Scan systables_index1 (tablename, schemaid) for a match.private TableDescriptor
getTableDescriptorIndex2Scan
(String tableUUID) Scan systables_index2 (tableid) for a match.getTablePermissions
(UUID tablePermsUUID) Get one user's privileges on a table using tablePermsUUIDgetTablePermissions
(UUID tableUUID, String authorizationId) Get one user's privileges on a tableGet the TransactionController to use, when not passed in as a parameter.Get the TransactionController to use, when not passed in as a parameter.private static SortedSet
<ColumnReference> getTransitionVariables
(Visitable node, String oldReferencingName, String newReferencingName) Get all columns that reference transition variables in triggers.getTriggerActionString
(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements, int[] cols) This method does the job of transforming the trigger action plan text as shown below.getTriggerDescriptor
(String name, SchemaDescriptor sd) Get the stored prepared statement descriptor given a sps name.getTriggerDescriptor
(UUID uuid) Get a TriggerDescriptor given its UUID.Load up the trigger descriptor list for this table descriptor and return it.private void
getTriggerDescriptorsScan
(TableDescriptor td, boolean forUpdate) Populate the TriggerDescriptorList for the specified TableDescriptor.(package private) ColPermsDescriptor
Get a column permissions descriptor from the system tables, without going through the cache.(package private) PermDescriptor
Get an object's permission descriptor from the system tables, without going through the cache.private <T extends PermissionsDescriptor>
TgetUncachedPermissionsDescriptor
(int catalogNumber, int indexNumber, T key, Class<T> returnType) (package private) RoutinePermsDescriptor
Get a routine permissions descriptor from the system tables, without going through the cache.protected SPSDescriptor
getUncachedSPSDescriptor
(UUID stmtId) This method can get called from the DataDictionary cache.(package private) SPSDescriptor
getUncachedSPSDescriptor
(TableKey stmtKey) This method can get called from the DataDictionary cache.protected TableDescriptor
getUncachedTableDescriptor
(UUID tableID) This method can get called from the DataDictionary cache.(package private) TableDescriptor
getUncachedTableDescriptor
(TableKey tableKey) This method can get called from the DataDictionary cache.(package private) TablePermsDescriptor
Get a table permissions descriptor from the system tables, without going through the cache.Return the credentials descriptor for the named user.Get the UUID Factory.private UUID
getUUIDForCoreTable
(String tableName, String schemaUUID, TransactionController tc) Get the UUID for the specified system table.getViewDescriptor
(UUID uuid) Gets the viewDescriptor for the view with the given UUID.Gets the viewDescriptor for the view given the TableDescriptor.private ViewDescriptor
Get the information for the view from sys.sysviews.getVTIClass
(TableDescriptor td, boolean asTableFunction) Return the Java class to use for the VTI to which the received table descriptor maps.private void
grantPublicAccessToSystemRoutine
(String schemaID, String routineName, char nameSpace, TransactionController tc, String authorizationID) Grant PUBLIC access to a system routine.void
grantPublicAccessToSystemRoutines
(HashSet newlyCreatedRoutines, TransactionController tc, String authorizationID) Grant PUBLIC access to specific system routines.Get all of the ConglomerateDescriptors in the database and hash them by conglomerate number.Get all of the TableDescriptors in the database and hash them by TableId This is useful as a performance optimization for the locking VTIs.void
Initialize catalog information.private void
Initialized the core info array.private void
Initialized the noncore info array.protected void
private void
initSystemIndexVariables
(TabInfoImpl ti, int indexNumber) void
Invalidate all the stored plans in SYS.SYSSTATEMENTS.void
Invalidate all the stored plans in SYS.SYSSTATEMENTS for the given language connection context.boolean
Check if the database is read only and requires some form of upgrade that makes the stored prepared statements invalid.boolean
Indicate whether there is anything in the particular schema.protected boolean
isSchemaReferenced
(TransactionController tc, TabInfoImpl ti, int indexId, int indexCol, DataValueDescriptor schemaIdOrderable) Is the schema id referenced by the system table in question?boolean
isSystemSchemaName
(String name) Determine whether a string is the name of the system schema.private static boolean
isTransitionVariable
(TableName tableName, String oldReferencingName, String newReferencingName) Check if a table name is actually a transition variable.private int[]
justTheRequiredColumns
(int[] columnsArrary, TableDescriptor triggerTableDescriptor) private void
loadCatalogs
(TabInfoImpl[] catalogArray) Initialize indices for an array of catalogsprivate void
loadDictionaryTables
(TransactionController tc, Properties startParams) Initialize system catalogs.private SchemaDescriptor
locateSchemaRow
(String schemaName, TransactionController tc) Get the target schema by searching for a matching row in SYSSCHEMAS by schema name.private SchemaDescriptor
locateSchemaRow
(UUID schemaId, int isolationLevel, TransactionController tc) Get the target schema by searching for a matching row in SYSSCHEMAS by schemaId.private SchemaDescriptor
locateSchemaRow
(UUID schemaId, TransactionController tc) Get the target schema by searching for a matching row in SYSSCHEMAS by schemaId.private SchemaDescriptor
locateSchemaRowBody
(UUID schemaId, int isolationLevel, TransactionController tc) private void
makeCatalog
(TabInfoImpl ti, SchemaDescriptor sd, TransactionController tc) The dirty work of creating a catalog.private ColumnDescriptor
makeColumnDescriptor
(SystemColumn column, int columnPosition, TableDescriptor td) Converts a SystemColumn to a ColumnDescriptor.makePasswordHasher
(Dictionary<?, ?> props) Get the default password hasher for this database level.private SchemaDescriptor
private static <T> List
<T> newSList()
private SchemaDescriptor
newSystemSchemaDesc
(String name, String uuid) peekAtIdentity
(String schemaName, String tableName) Peek at the next value which will be returned by an identity generator.peekAtSequence
(String schemaName, String sequenceName) Peek at the next value which will be returned by a sequence generator.protected void
Populate SYSDUMMY1 table with a single row.private void
Map ( schemaName, sequenceName ) to sequenceIDprivate void
Remove PermissionsDescriptor from permissions cache if presentvoid
Reset the database owner according to what is stored in the catalogs.private void
rewriteSYSCOLPERMSforAlterTable
(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor) Workhorse for ALTER TABLE-driven mods to SYSCOLPERMS This method finds all the SYSCOLPERMS rows for this table.final Properties
run()
void
setAutoincrementValue
(TransactionController tc, UUID tableUUID, String columnName, long aiValue, boolean incrementNeeded) sets a new value in SYSCOLUMNS for a particular autoincrement column.private void
setCacheMode
(int newMode) protected void
sets the dependencymanager associated with this dd. subclasses can override this to install their own funky dependency manager.(package private) void
Mark this database as a read only database whose stored prepared statements are invalid because some kind of upgrade is needed.(package private) void
Add an entry to the hashtables for lookup from the cache.(package private) void
int
Inform this DataDictionary that we are about to start reading it.private static Object
startSystemModule
(String factoryInterface) Privileged startup.void
Inform this DataDictionary that we are about to start writing to it.void
stop()
Stop this module.void
Inform this DataDictionary that the transaction in which writes have been done (or may have been done) has been committed or rolled back.private static String
twoDigits
(int val) private void
updateColumnDescriptor
(ColumnDescriptor cd, UUID formerUUID, String formerName, int[] colsToSet, TransactionController tc) Update the column descriptor in question.void
updateConglomerateDescriptor
(ConglomerateDescriptor[] cds, long conglomerateNumber, TransactionController tc) Update the conglomerateNumber for an array of ConglomerateDescriptors.void
updateConglomerateDescriptor
(ConglomerateDescriptor cd, long conglomerateNumber, TransactionController tc) Update the conglomerateNumber for a ConglomerateDescriptor.void
updateConstraintDescriptor
(ConstraintDescriptor cd, UUID formerUUID, int[] colsToSet, TransactionController tc) Update the constraint descriptor in question.boolean
updateCurrentSequenceValue
(TransactionController tc, RowLocation rowLocation, boolean wait, Long oldValue, Long newValue) Set the current value of an ANSI/ISO sequence.void
updateLockGranularity
(TableDescriptor td, SchemaDescriptor schema, char lockGranularity, TransactionController tc) Update the lockGranularity for the specified table.void
Drop and recreate metadata stored prepared statements.void
updateSchemaAuth
(String schemaName, String authorizationId, TransactionController tc) Update authorizationId of specified schemaNamevoid
updateSPS
(SPSDescriptor spsd, TransactionController tc, boolean recompile) Updates SYS.SYSSTATEMENTS with the info from the SPSD.void
Need to update SYSCOLPERMS for a given table because a new column has been added to that table.void
updateSYSCOLPERMSforDropColumn
(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor) Update SYSCOLPERMS due to dropping a column from a table.void
Update all system schemas to have new authorizationId.void
updateTriggerDescriptor
(TriggerDescriptor triggerd, UUID formerUUID, int[] colsToSet, TransactionController tc) Update the trigger descriptor in question.void
updateUser
(UserDescriptor newDescriptor, TransactionController tc) Update a user.void
upgrade_addColumns
(CatalogRowFactory rowFactory, int[] newColumnIDs, TransactionController tc) Upgrade an existing catalog by adding columns.void
upgrade_addInvisibleColumns
(CatalogRowFactory rowFactory, int[] newColumnIDs, TransactionController tc) Add invisible columns to an existing system catalog(package private) void
upgrade_initSystemTableCols
(TransactionController tc, boolean isCoreTable, int tableNum, FormatableBitSet columnsToUpdateSet, DataValueDescriptor[] replaceRow) Initialize noncore columns to fixed values(package private) void
Add autoinccycle columns to an SYSCOLUMNS system catalog(package private) void
10.6 upgrade logic to update the return type of SYSIBM.CLOBGETSUBSTRING.void
upgradeFixSystemColumnDefinition
(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.protected void
Called by the upgrade code to upgrade the way we store jar files in the database.protected void
upgradeMakeCatalog
(TransactionController tc, int catalogNumber) called by the upgrade code (dd_xena etc) to add a new system catalog.(package private) void
10.6 upgrade logic to update the permissions granted to SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE.boolean
Get authorization model in force, SqlStandard or legacy modeprivate boolean
visitPermsByGrantee
(String authId, TransactionController tc, int catalog, int indexNo, int granteeColnoInIndex, int action) ScanindexNo
index on a permission tablecatalog
, looking for match(es) for the grantee column (given by granteeColnoInIndex for the catalog in question).private boolean
visitRoleGrants
(TabInfoImpl ti, SYSROLESRowFactory rf, int columnNo, String authId, TransactionController tc, int action) Scan the {roleid, grantee, grantor} index on SYSROLES, locate rows containing authId in column columnNo.private void
widenConglomerate
(ExecRow templateRow, int[] newColumnIDs, long conglomID, TransactionController tc) Adds columns to the conglomerate underlying a system table.
-
Field Details
-
CFG_SYSTABLES_ID
- See Also:
-
CFG_SYSTABLES_INDEX1_ID
- See Also:
-
CFG_SYSTABLES_INDEX2_ID
- See Also:
-
CFG_SYSCOLUMNS_ID
- See Also:
-
CFG_SYSCOLUMNS_INDEX1_ID
- See Also:
-
CFG_SYSCOLUMNS_INDEX2_ID
- See Also:
-
CFG_SYSCONGLOMERATES_ID
- See Also:
-
CFG_SYSCONGLOMERATES_INDEX1_ID
- See Also:
-
CFG_SYSCONGLOMERATES_INDEX2_ID
- See Also:
-
CFG_SYSCONGLOMERATES_INDEX3_ID
- See Also:
-
CFG_SYSSCHEMAS_ID
- See Also:
-
CFG_SYSSCHEMAS_INDEX1_ID
- See Also:
-
CFG_SYSSCHEMAS_INDEX2_ID
- See Also:
-
SYSCONGLOMERATES_CORE_NUM
private static final int SYSCONGLOMERATES_CORE_NUM- See Also:
-
SYSTABLES_CORE_NUM
private static final int SYSTABLES_CORE_NUM- See Also:
-
SYSCOLUMNS_CORE_NUM
private static final int SYSCOLUMNS_CORE_NUM- See Also:
-
SYSSCHEMAS_CORE_NUM
private static final int SYSSCHEMAS_CORE_NUM- See Also:
-
NUM_CORE
private static final int NUM_CORE- See Also:
-
SYSFUN_FUNCTIONS
SYSFUN functions. Table of functions that automatically appear in the SYSFUN schema. These functions are resolved to directly if no schema name is given, e.g.SELECT COS(angle) FROM ROOM_WALLS
Adding a function here is suitable when the function defintion can have a single return type and fixed parameter types. Functions that need to have a return type based upon the input type(s) are not supported here. Typically those are added into the parser and methods added into the DataValueDescriptor interface. Examples are character based functions whose return type length is based upon the passed in type, e.g. passed a CHAR(10) returns a CHAR(10). This simple table can handle an arbitrary number of arguments and RETURNS NULL ON NULL INPUT. The scheme could be expanded to handle other function options such as other parameters if needed. [0] = FUNCTION name [1] = RETURNS type [2] = Java class [3] = method name and signature [4] = "true" or "false" depending on whether the function is DETERMINSTIC [5] = "true" or "false" depending on whether the function has VARARGS [6..N] = arguments (optional, if not present zero arguments is assumed) -
SYSFUN_DETERMINISTIC_INDEX
private static final int SYSFUN_DETERMINISTIC_INDEXIndex into SYSFUN_FUNCTIONS of the DETERMINISTIC indicator. Used to determine whether the system function is DETERMINISTIC- See Also:
-
SYSFUN_VARARGS_INDEX
private static final int SYSFUN_VARARGS_INDEXIndex into SYSFUN_FUNCTIONS of the VARARGS indicator. Used to determine whether the system function has VARARGS- See Also:
-
SYSFUN_FIRST_PARAMETER_INDEX
private static final int SYSFUN_FIRST_PARAMETER_INDEXThe index of the first parameter in entries in the SYSFUN_FUNCTIONS table. Used to determine the parameter count (zero to many).- See Also:
-
sysfunDescriptors
Runtime definition of the functions from SYSFUN_FUNCTIONS. Populated dynamically as functions are called. -
coreInfo
-
systemSchemaDesc
-
sysIBMSchemaDesc
-
declaredGlobalTemporaryTablesSchemaDesc
-
systemUtilSchemaDesc
-
nonCoreNames
-
NUM_NONCORE
private static final int NUM_NONCORE -
systemSchemaNames
List of all "system" schemasThis list should contain all schema's used by the system and are created when the database is created. Users should not be able to create or drop these schema's and should not be able to create or drop objects in these schema's. This list is used by code that needs to check if a particular schema is a "system" schema.
-
dictionaryVersion
Dictionary version of the on-disk database -
softwareVersion
Dictionary version of the currently running engine -
authorizationDatabaseOwner
-
usesSqlAuthorization
private boolean usesSqlAuthorization -
noncoreInfo
-
dataDescriptorGenerator
-
dvf
-
af
-
exFactory
-
uuidFactory
-
indexRefresher
Daemon creating and refreshing index cardinality statistics. -
startupParameters
Properties startupParameters -
engineType
int engineType -
booting
protected boolean booting -
bootingTC
-
dmgr
-
OIDTdCache
CacheManager OIDTdCache -
nameTdCache
CacheManager nameTdCache -
spsNameCache
-
sequenceGeneratorCache
-
spsIdHash
-
tdCacheSize
int tdCacheSize -
stmtCacheSize
int stmtCacheSize -
seqgenCacheSize
private int seqgenCacheSize -
permissionsCache
CacheManager permissionsCache -
permissionsCacheSize
int permissionsCacheSize -
cacheCoordinator
ShExLockable cacheCoordinator -
lockFactory
-
cacheMode
volatile int cacheMode -
ddlUsers
volatile int ddlUsers -
readersInDDLMode
volatile int readersInDDLMode -
sequenceIDs
-
readOnlyUpgrade
private boolean readOnlyUpgradeTrue if the database is read only and requires some form of upgrade, that makes the stored prepared statements invalid. With this case the engine is running at a different version to the underlying stored database. This can happen in 5.1 if the database is read only and a different point release (later than 5.1.25?) to the one that created it, has been booted. (Beetle 5170).In 5.2 and newer this will be the case if the engine booting the database is newer than the engine that created it.
-
indexStatsUpdateDisabled
private boolean indexStatsUpdateDisabledTells if the automatic index statistics refresher has been disabled.The refresher can be disabled explicitly by the user by setting a property (system wide or database property), or if the daemon encounters an exception it doesn't know how to recover from.
-
indexStatsUpdateLogging
private boolean indexStatsUpdateLogging -
indexStatsUpdateTracing
-
systemSQLNameNumber
private int systemSQLNameNumber -
calendarForLastSystemSQLName
-
timeForLastSystemSQLName
private long timeForLastSystemSQLName -
sysUtilProceduresWithPublicAccess
List of procedures in SYSCS_UTIL schema with PUBLIC access -
sysUtilFunctionsWithPublicAccess
List of functions in SYSCS_UTIL schema with PUBLIC access -
collationTypeOfSystemSchemas
private int collationTypeOfSystemSchemasCollation Type for SYSTEM schemas. In Derby 10.3, this will always be UCS_BASIC -
collationTypeOfUserSchemas
private int collationTypeOfUserSchemasCollation 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 provide 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. -
DROP
static final int DROPPossible action for visitPermsByGrantee and visitRoleGrants.- See Also:
-
EXISTS
static final int EXISTSPossible action for visitPermsByGrantee and visitRoleGrants.- See Also:
-
spsSet
-
colPrivTypeMap
-
colPrivTypeMapForGrant
-
DIAG_VTI_TABLE_CLASSES
-
DIAG_VTI_TABLE_FUNCTION_CLASSES
-
-
Constructor Details
-
DataDictionaryImpl
public DataDictionaryImpl()
-
-
Method Details
-
canSupport
This is the data dictionary implementation for the standard database engine.- Specified by:
canSupport
in interfaceModuleSupportable
- Returns:
- true if this service requested is for a database engine.
-
boot
Start-up method for this instance of the data dictionary.- Specified by:
boot
in interfaceModuleControl
- Parameters:
startParams
- The start-up parameters- Throws:
StandardException
- Thrown if the module fails to start- See Also:
-
findDefaultBuiltinAlgorithm
Find the default message digest algorithm to use for BUILTIN authentication on this database.- Returns:
- the name of the algorithm to use as the default
-
getPermissionsCache
- Throws:
StandardException
-
setDependencyManager
protected void setDependencyManager()sets the dependencymanager associated with this dd. subclasses can override this to install their own funky dependency manager. -
getDependencyManager
returns the dependencymanager associated with this datadictionary.- Specified by:
getDependencyManager
in interfaceDataDictionary
- See Also:
-
stop
public void stop()Stop this module. In this case, nothing needs to be done.- Specified by:
stop
in interfaceModuleControl
- See Also:
-
newCacheable
- Specified by:
newCacheable
in interfaceCacheableFactory
-
startReading
Description copied from interface:DataDictionary
Inform this DataDictionary that we are about to start reading it. This means using the various get methods in the DataDictionary. Generally, this is done during query compilation.- Specified by:
startReading
in 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:
-
doneReading
Description copied from interface:DataDictionary
Inform this DataDictionary that we have finished reading it. This typically happens at the end of compilation.- Specified by:
doneReading
in interfaceDataDictionary
- Parameters:
mode
- The mode that was returned by startReading().lcc
- The LanguageConnectionContext to use.- Throws:
StandardException
- Thrown on error
-
startWriting
Description copied from interface:DataDictionary
Inform this DataDictionary that we are about to start writing to it. This means using the various add and drop methods in the DataDictionary. Generally, this is done during execution of DDL.- Specified by:
startWriting
in interfaceDataDictionary
- Parameters:
lcc
- The LanguageConnectionContext to use.- Throws:
StandardException
- Thrown on error
-
transactionFinished
Description copied from interface:DataDictionary
Inform this DataDictionary that the transaction in which writes have been done (or may have been done) has been committed or rolled back.- Specified by:
transactionFinished
in interfaceDataDictionary
- Throws:
StandardException
- Thrown on error
-
getCacheMode
public int getCacheMode()Description copied from interface:DataDictionary
Returns the cache mode of the data dictionary.- Specified by:
getCacheMode
in interfaceDataDictionary
-
setCacheMode
private void setCacheMode(int newMode) -
getDataDescriptorGenerator
Get a DataDescriptorGenerator, through which we can create objects to be stored in the DataDictionary.- Specified by:
getDataDescriptorGenerator
in interfaceDataDictionary
- Returns:
- A DataDescriptorGenerator
-
getAuthorizationDatabaseOwner
Get authorizationID of Database Owner- Specified by:
getAuthorizationDatabaseOwner
in interfaceDataDictionary
- Returns:
- authorizationID
-
usesSqlAuthorization
public boolean usesSqlAuthorization()Description copied from interface:DataDictionary
Get authorization model in force, SqlStandard or legacy mode- Specified by:
usesSqlAuthorization
in interfaceDataDictionary
- Returns:
- Whether sqlAuthorization is being used
- See Also:
-
getCollationTypeOfSystemSchemas
public int getCollationTypeOfSystemSchemas()Description copied from interface:DataDictionary
Return the collation type for SYSTEM schemas. In Derby 10.3, this will always be UCS_BASIC- Specified by:
getCollationTypeOfSystemSchemas
in interfaceDataDictionary
- Returns:
- the collation type for SYSTEM schemas
- See Also:
-
getCollationTypeOfUserSchemas
public int getCollationTypeOfUserSchemas()Description copied from interface:DataDictionary
Return the collation type for user schemas. In Derby 10.3, this is either UCS_BASIC or TERRITORY_BASED. The exact value is decided by what has user asked for through JDBC url optional attribute COLLATION. If that atrribute is set to UCS_BASIC, the collation type for user schemas will be UCS_BASIC. If that attribute is set to TERRITORY_BASED, the collation type for user schemas will be TERRITORY_BASED. If the user has not provided COLLATION attribute value in the JDBC url at database create time, then collation type of user schemas will default to UCS_BASIC. Pre-10.3 databases after upgrade to Derby 10.3 will also use UCS_BASIC for collation type of user schemas.- Specified by:
getCollationTypeOfUserSchemas
in interfaceDataDictionary
- Returns:
- the collation type for user schemas
- See Also:
-
getDataValueFactory
Get a DataValueFactory, through which we can create data value objects.- Specified by:
getDataValueFactory
in interfaceDataDictionary
- Returns:
- A DataValueFactory
-
getExecutionFactory
Get ExecutionFactory associated with this database.- Specified by:
getExecutionFactory
in interfaceDataDictionary
- Returns:
- The ExecutionFactory
-
getBuiltinSystemSchemas
private void getBuiltinSystemSchemas()Set up the builtin schema descriptors for system schemas. -
makePasswordHasher
Description copied from interface:DataDictionary
Get the default password hasher for this database level. Returns null if the system is at rev level 10.5 or earlier.- Specified by:
makePasswordHasher
in interfaceDataDictionary
- Parameters:
props
- The persistent properties used to configure password hashing.- Throws:
StandardException
-
generateRandomSalt
Generate an array of random bytes to use as salt when hashing credentials.- Parameters:
props
- database properties that possibly specify the desired length of the salt- Returns:
- random bytes
-
getIntProperty
private int getIntProperty(Dictionary props, String key, int defaultValue, int minValue, int maxValue) Get the value of an integer property.- Parameters:
props
- database propertieskey
- the key of the propertydefaultValue
- which value to return if the property is not set, or if the property value is not in the valid rangeminValue
- lowest property value to acceptmaxValue
- highest property value to accept- Returns:
- the value of the property
-
getSystemSchemaDescriptor
Get the descriptor for the system schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this.- Specified by:
getSystemSchemaDescriptor
in interfaceDataDictionary
- Returns:
- The descriptor for the schema.
- Throws:
StandardException
- Thrown on failure
-
getSystemUtilSchemaDescriptor
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
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:
getSysIBMSchemaDescriptor
in interfaceDataDictionary
- Returns:
- The descriptor for the schema.
- Throws:
StandardException
- Thrown on failure
-
getDeclaredGlobalTemporaryTablesSchemaDescriptor
Get the descriptor for the declared global temporary table schema which is always named "SESSION".- Specified by:
getDeclaredGlobalTemporaryTablesSchemaDescriptor
in interfaceDataDictionary
- Returns:
- The descriptor for the schema.
- Throws:
StandardException
- Thrown on failure
-
isSystemSchemaName
Determine whether a string is the name of the system schema.- Specified by:
isSystemSchemaName
in interfaceDataDictionary
- Parameters:
name
-- Returns:
- true or false
- Throws:
StandardException
- Thrown on failure
-
getSchemaDescriptor
public SchemaDescriptor getSchemaDescriptor(String schemaName, TransactionController tc, boolean raiseError) throws StandardException Get the descriptor for the named schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this. Will check default schema for a match before scanning a system table.- Specified by:
getSchemaDescriptor
in 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
-
locateSchemaRow
private SchemaDescriptor locateSchemaRow(UUID schemaId, TransactionController tc) throws StandardException Get the target schema by searching for a matching row in SYSSCHEMAS by schemaId. Read only scan.- Parameters:
schemaId
- The id of the schema we're interested in. If non-null, overrides schemaNametc
- TransactionController. If null, one is gotten off of the language connection context.- Returns:
- The row for the schema
- Throws:
StandardException
- Thrown on error
-
locateSchemaRow
private SchemaDescriptor locateSchemaRow(UUID schemaId, int isolationLevel, TransactionController tc) throws StandardException Get the target schema by searching for a matching row in SYSSCHEMAS by schemaId. Read only scan.- Parameters:
schemaId
- The id of the schema we're interested in. If non-null, overrides schemaNameisolationLevel
- Use this explicit isolation level. Only ISOLATION_REPEATABLE_READ (normal usage) or ISOLATION_READ_UNCOMMITTED (corner cases) supported for now.tc
- TransactionController. If null, one is gotten off of the language connection context.- Returns:
- The row for the schema
- Throws:
StandardException
- Thrown on error
-
locateSchemaRowBody
private SchemaDescriptor locateSchemaRowBody(UUID schemaId, int isolationLevel, TransactionController tc) throws StandardException - Throws:
StandardException
-
locateSchemaRow
private SchemaDescriptor locateSchemaRow(String schemaName, TransactionController tc) throws StandardException Get the target schema by searching for a matching row in SYSSCHEMAS by schema name. Read only scan.- Parameters:
schemaName
- The name of the schema we're interested in. If schemaId is null, used to qual.tc
- TransactionController. If null, one is gotten off of the language connection context.- Returns:
- The row for the schema
- 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:
getSchemaDescriptor
in 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:
getSchemaDescriptor
in 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
-
getSchemaDescriptorBody
private SchemaDescriptor getSchemaDescriptorBody(UUID schemaId, int isolationLevel, TransactionController tc) throws StandardException - Throws:
StandardException
-
existsSchemaOwnedBy
public boolean existsSchemaOwnedBy(String authid, TransactionController tc) throws StandardException Return true of there exists a schema whose authorizationId equals authid, i.e. SYS.SYSSCHEMAS contains a row whose column (AUTHORIZATIONID) equals authid.- Specified by:
existsSchemaOwnedBy
in 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:DataDictionary
Adds a descriptor to a system catalog identified by the catalogNumber.- Specified by:
addDescriptor
in 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:
-
duplicateDescriptorException
private StandardException duplicateDescriptorException(TupleDescriptor tuple, TupleDescriptor parent) -
addDescriptorArray
public void addDescriptorArray(TupleDescriptor[] td, TupleDescriptor parent, int catalogNumber, boolean allowDuplicates, TransactionController tc) throws StandardException array version of addDescriptor.- Specified by:
addDescriptorArray
in interfaceDataDictionary
- Throws:
StandardException
- See Also:
-
dropRoleGrant
public void dropRoleGrant(String roleName, String grantee, String grantor, TransactionController tc) throws StandardException Description copied from interface:DataDictionary
Drop a role grant- Specified by:
dropRoleGrant
in interfaceDataDictionary
- Parameters:
roleName
- The name of the role to dropgrantee
- The granteegrantor
- The grantortc
- Transaction Controller- Throws:
StandardException
- Thrown on failure- See Also:
-
dropSchemaDescriptor
public void dropSchemaDescriptor(String schemaName, TransactionController tc) throws StandardException Drop the descriptor for a schema, given the schema's name- Specified by:
dropSchemaDescriptor
in interfaceDataDictionary
- Parameters:
schemaName
- The name of the schema to droptc
- TransactionController for the transaction- Throws:
StandardException
- Thrown on error
-
getTableDescriptor
public TableDescriptor getTableDescriptor(String tableName, SchemaDescriptor schema, TransactionController tc) throws StandardException Get the descriptor for the named table within the given schema. If the schema parameter is NULL, it looks for the table in the current (default) schema. Table descriptors include object ids, object types (table, view, etc.)- Specified by:
getTableDescriptor
in 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
-
getTableDescriptorIndex1Scan
private TableDescriptor getTableDescriptorIndex1Scan(String tableName, String schemaUUID) throws StandardException Scan systables_index1 (tablename, schemaid) for a match.- Returns:
- TableDescriptor The matching descriptor, if any.
- Throws:
StandardException
- Thrown on failure
-
getUncachedTableDescriptor
This method can get called from the DataDictionary cache.- Parameters:
tableKey
- The TableKey of the table- Returns:
- The descriptor for the table, null if the table does not exist.
- Throws:
StandardException
- Thrown on failure
-
getTableDescriptor
Get the descriptor for the table with the given UUID. NOTE: I'm assuming that the object store will define an UUID for persistent objects. I'm also assuming that UUIDs are unique across schemas, and that the object store will be able to do efficient lookups across schemas (i.e. that no schema descriptor parameter is needed).- Specified by:
getTableDescriptor
in 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
-
getUncachedTableDescriptor
This method can get called from the DataDictionary cache.- 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
-
getTableDescriptorIndex2Scan
Scan systables_index2 (tableid) for a match.- Returns:
- TableDescriptor The matching descriptor, if any.
- Throws:
StandardException
- Thrown on failure
-
finishTableDescriptor
Finish filling in the TableDescriptor. (Build the various lists that hang off the TD.)- Parameters:
td
- The TableDescriptor.- Returns:
- The completed TableDescriptor.
- Throws:
StandardException
- Thrown on failure
-
isSchemaEmpty
Indicate whether there is anything in the particular schema. Checks for tables in the the schema, on the assumption that there cannot be any other objects in a schema w/o a table.- Specified by:
isSchemaEmpty
in interfaceDataDictionary
- Parameters:
sd
- descriptor- Returns:
- true/false
- Throws:
StandardException
- on error
-
isSchemaReferenced
protected boolean isSchemaReferenced(TransactionController tc, TabInfoImpl ti, int indexId, int indexCol, DataValueDescriptor schemaIdOrderable) throws StandardException Is the schema id referenced by the system table in question? Currently assumes that the schema id is in an index. NOTE: could be generalized a bit, and possibly used elsewhere...- Parameters:
tc
- transaction controllerti
- table info for the system tableindexId
- index idindexCol
- 1 based index columnschemaIdOrderable
- the schemaid in a char orderable- Returns:
- true if there is a reference to this schema
- Throws:
StandardException
- on error
-
dropTableDescriptor
public void dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema, TransactionController tc) throws StandardException Drop the table descriptor.- Specified by:
dropTableDescriptor
in 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:
updateLockGranularity
in 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
-
upgradeCLOBGETSUBSTRING_10_6
10.6 upgrade logic to update the return type of SYSIBM.CLOBGETSUBSTRING. The length of the return type was changed in 10.5 but old versions of the metadata were not upgraded at that time. See DERBY-4214.- Throws:
StandardException
-
upgradeSYSROUTINEPERMS_10_6
10.6 upgrade logic to update the permissions granted to SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE. If a 10.0 database was upgraded to 10.2, 10.3, or 10.4, then there will be an extra permissions tuple in SYSROUTINEPERMS--that tuple will have a null grantor field. We must delete this tuple. See DERBY-4215.- Throws:
StandardException
-
getColumnDescriptorByDefaultId
Get a ColumnDescriptor given its Default ID.- Specified by:
getColumnDescriptorByDefaultId
in interfaceDataDictionary
- Parameters:
uuid
- The UUID of the default- Returns:
- The ColumnDescriptor for the column.
- Throws:
StandardException
- Thrown on failure
-
getColumnDescriptorsScan
Populate the ColumnDescriptorList for the specified TableDescriptor. MT synchronization: it is assumed that the caller has synchronized on the CDL in the given TD.- Parameters:
td
- The TableDescriptor.- Throws:
StandardException
- Thrown on failure
-
getColumnDescriptorsScan
private void getColumnDescriptorsScan(UUID uuid, ColumnDescriptorList cdl, TupleDescriptor td) throws StandardException Populate the ColumnDescriptorList for the specified TableDescriptor. MT synchronization: it is assumed that the caller has synchronized on the CDL in the given TD.- Parameters:
uuid
- The referencing UUIDcdl
- The column descriptor listtd
- The parent tuple descriptor- Throws:
StandardException
- Thrown on failure
-
dropColumnDescriptor
public void dropColumnDescriptor(UUID tableID, String columnName, TransactionController tc) throws StandardException Given a column name and a table ID, drops the column descriptor from the table.- Specified by:
dropColumnDescriptor
in 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:
dropAllColumnDescriptors
in 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:
dropAllTableAndColPermDescriptors
in 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:
updateSYSCOLPERMSforAddColumnToUserTable
in 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:
updateSYSCOLPERMSforDropColumn
in 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
-
rewriteSYSCOLPERMSforAlterTable
private void rewriteSYSCOLPERMSforAlterTable(UUID tableID, TransactionController tc, ColumnDescriptor columnDescriptor) throws StandardException Workhorse for ALTER TABLE-driven mods to SYSCOLPERMS This method finds all the SYSCOLPERMS rows for this table. Then it iterates through each row, either adding a new column to the end of the table, or dropping a column from the table, as appropriate. It updates each SYSCOLPERMS row to store the new COLUMNS value.- Parameters:
tableID
- The UUID of the table being alteredtc
- TransactionController for the transactioncolumnDescriptor
- Dropped column info, or null if adding- Throws:
StandardException
- Thrown on error
-
removePermEntryInCache
Remove PermissionsDescriptor from permissions cache if present- Throws:
StandardException
-
dropAllRoutinePermDescriptors
public void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc) throws StandardException Drops all routine permission descriptors for the given routine.- Specified by:
dropAllRoutinePermDescriptors
in 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(String grantee, TransactionController tc) throws StandardException Description copied from interface:DataDictionary
Drop all role grants corresponding to a grant of (any) role to a named authentication identifier- Specified by:
dropRoleGrantsByGrantee
in interfaceDataDictionary
- Parameters:
grantee
- The granteetc
- Transaction Controller- Throws:
StandardException
- Thrown on failure- See Also:
-
existsRoleGrantByGrantee
private boolean existsRoleGrantByGrantee(String grantee, TransactionController tc) throws StandardException Return true if there exists a role grant to authorization identifier.- Parameters:
grantee
- authorization identifiertc
- Transaction Controller- Returns:
- true if there exists such a grant
- Throws:
StandardException
- Thrown on failure
-
dropRoleGrantsByName
public void dropRoleGrantsByName(String roleName, TransactionController tc) throws StandardException Description copied from interface:DataDictionary
Drop all role grants corresponding to a grant of the named role to any authentication identifier- Specified by:
dropRoleGrantsByName
in interfaceDataDictionary
- Parameters:
roleName
- The role name grantedtc
- Transaction Controller- Throws:
StandardException
- Thrown on failure- See Also:
-
visitRoleGrants
private boolean visitRoleGrants(TabInfoImpl ti, SYSROLESRowFactory rf, int columnNo, String authId, TransactionController tc, int action) throws StandardException Scan the {roleid, grantee, grantor} index on SYSROLES, locate rows containing authId in column columnNo. The action argument can be eitherEXISTS
orDROP
(to check for existence, or to drop that row). If the scan proves too slow, we should add more indexes. only.- Parameters:
ti
-TabInfoImpl
for SYSROLES.rf
- row factory for SYSROLEScolumnNo
- the column number to matchauthId
againsttc
- transaction controlleraction
- drop matching rows (DROP
), or returntrue
if there is a matching row (EXISTS
)- Returns:
- action=EXISTS: return
true
if there is a matching row else returnfalse
. - Throws:
StandardException
-
getRoleGrantGraph
HashMap<String,List<RoleGrantDescriptor>> getRoleGrantGraph(TransactionController tc, boolean inverse) throws StandardException Return an in-memory representation of the role grant graph (sans grant of roles to users, only role-role relation.- Parameters:
tc
- Transaction Controllerinverse
- make graph on inverse grant relation- Returns:
- hash map representing role grant graph.
- Key: rolename,
- Value: List
representing a grant of that rolename to another role (not user).
- Throws:
StandardException
-
createRoleClosureIterator
public RoleClosureIterator createRoleClosureIterator(TransactionController tc, String role, boolean inverse) throws StandardException Description copied from interface:DataDictionary
This method creates a new iterator over the closure of role grants starting or ending with a given role. This method will cause reading of dictionary, so should be called inside a transaction, after add.startReading()
ordd.startWriting()
call.- Specified by:
createRoleClosureIterator
in 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:
-
dropAllPermsByGrantee
Drop all permission descriptors corresponding to a grant to the named authentication identifier- Specified by:
dropAllPermsByGrantee
in interfaceDataDictionary
- Parameters:
authId
- The authentication identifiertc
- Transaction Controller- Throws:
StandardException
- Thrown on failure
-
dropPermsByGrantee
private void dropPermsByGrantee(String authId, TransactionController tc, int catalog, int indexNo, int granteeColnoInIndex) throws StandardException Presently only used when dropping roles - user dropping is not under Derby control (well, built-in users are if properties are stored in database), any permissions granted to users remain in place even if the user is no more.- Throws:
StandardException
-
existsPermByGrantee
private boolean existsPermByGrantee(String authId, TransactionController tc, int catalog, int indexNo, int granteeColnoInIndex) throws StandardException Return true if there exists a permission grant descriptor to this authorization id.- Throws:
StandardException
-
visitPermsByGrantee
private boolean visitPermsByGrantee(String authId, TransactionController tc, int catalog, int indexNo, int granteeColnoInIndex, int action) throws StandardException ScanindexNo
index on a permission tablecatalog
, looking for match(es) for the grantee column (given by granteeColnoInIndex for the catalog in question). The action argument can be eitherEXISTS
orDROP
(to check for existence, or to drop that row). There is no index on grantee column only on on any of the permissions tables, so we use the index which contain grantee and scan that, setting up a scan qualifier to match the grantee, then fetch the base row. If this proves too slow, we should add an index on grantee only.- Parameters:
authId
- grantee to match againsttc
- transaction controllercatalog
- the underlying permission table to visitindexNo
- the number of the index by which to access the cataloggranteeColnoInIndex
- the column number to matchauthId
againstaction
- drop matching rows (DROP
), or returntrue
if there is a matching row (EXISTS
)- Returns:
- action=EXISTS: return
true
if there is a matching row else returnfalse
. - Throws:
StandardException
-
dropColumnDescriptorCore
private void dropColumnDescriptorCore(TransactionController tc, ExecIndexRow keyRow) throws StandardException Delete the appropriate rows from syscolumns when dropping 1 or more columns.- Parameters:
tc
- The TransactionControllerkeyRow
- Start/stop position.- Throws:
StandardException
- Thrown on failure
-
dropTablePermDescriptor
private void dropTablePermDescriptor(TransactionController tc, ExecIndexRow keyRow) throws StandardException Delete the appropriate rows from systableperms when dropping a table- Parameters:
tc
- The TransactionControllerkeyRow
- Start/stop position.- Throws:
StandardException
- Thrown on failure
-
dropColumnPermDescriptor
private void dropColumnPermDescriptor(TransactionController tc, ExecIndexRow keyRow) throws StandardException Delete the appropriate rows from syscolperms when dropping a table- Parameters:
tc
- The TransactionControllerkeyRow
- Start/stop position.- Throws:
StandardException
- Thrown on failure
-
updateColumnDescriptor
private void updateColumnDescriptor(ColumnDescriptor cd, UUID formerUUID, String formerName, int[] colsToSet, TransactionController tc) throws StandardException Update the column descriptor in question. Updates every row in the base conglomerate.- Parameters:
cd
- The ColumnDescriptorformerUUID
- The UUID for this column in SYSCOLUMNS, may differ from what is in cd if this is the column that is being set.formerName
- The name for this column in SYSCOLUMNS may differ from what is in cd if this is the column that is being set.colsToSet
- Array of ints of columns to be modified, 1 based. May be null (all cols).tc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
getViewDescriptor
Gets the viewDescriptor for the view with the given UUID.- Specified by:
getViewDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- The UUID for the view- Returns:
- A descriptor for the view
- Throws:
StandardException
- Thrown on error
-
getViewDescriptor
Gets the viewDescriptor for the view given the TableDescriptor.- Specified by:
getViewDescriptor
in interfaceDataDictionary
- Parameters:
td
- The TableDescriptor for the view.- Returns:
- A descriptor for the view
- Throws:
StandardException
- Thrown on error
-
getViewDescriptorScan
Get the information for the view from sys.sysviews.- Parameters:
tdi
- The TableDescriptor for the view.- Returns:
- ViewDescriptor The ViewDescriptor 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:
dropViewDescriptor
in interfaceDataDictionary
- Parameters:
vd
- A descriptor for the view to be droppedtc
- TransactionController to use- Throws:
StandardException
- Thrown on error
-
getFileInfoDescriptorIndex2Scan
Scan sysfiles_index2 (id) for a match.- Returns:
- TableDescriptor The matching descriptor, or null.
- Throws:
StandardException
- Thrown on failure
-
getFileInfoDescriptor
Description copied from interface:DataDictionary
Get a FileInfoDescriptor given its id.- Specified by:
getFileInfoDescriptor
in interfaceDataDictionary
- Parameters:
id
- The descriptor's id.- Throws:
StandardException
- Thrown on failure- See Also:
-
getFileInfoDescriptorIndex1Scan
private FileInfoDescriptor getFileInfoDescriptorIndex1Scan(UUID schemaId, String name) throws StandardException Scan sysfiles_index1 (schemaid,name) for a match.- Returns:
- The matching descriptor or null.
- Throws:
StandardException
- Thrown on failure
-
getFileInfoDescriptor
public FileInfoDescriptor getFileInfoDescriptor(SchemaDescriptor sd, String name) throws StandardException Description copied from interface:DataDictionary
Get a FileInfoDescriptor given its SQL name and schema name.- Specified by:
getFileInfoDescriptor
in interfaceDataDictionary
- Parameters:
sd
- the schema that holds the FileInfoDescriptor.name
- SQL name of file.- Throws:
StandardException
- Thrown on failure- See Also:
-
dropFileInfoDescriptor
Description copied from interface:DataDictionary
Drop a FileDescriptor from the datadictionary.- Specified by:
dropFileInfoDescriptor
in interfaceDataDictionary
- Throws:
StandardException
- Thrown on error- See Also:
-
getSPSDescriptor
Get a SPSDescriptor given its UUID.- Specified by:
getSPSDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- The UUID- Returns:
- The SPSDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
spsCacheEntryAdded
Add an entry to the hashtables for lookup from the cache. -
spsCacheEntryRemoved
-
getUncachedSPSDescriptor
This method can get called from the DataDictionary cache.- Parameters:
stmtKey
- The TableKey of the sps- Returns:
- The descriptor for the sps, null if the sps does not exist.
- Throws:
StandardException
- Thrown on failure
-
getUncachedSPSDescriptor
This method can get called from the DataDictionary cache.- Parameters:
stmtId
- The UUID of the stmt to get the descriptor for- Returns:
- The descriptor for the stmt, null if the table does not exist.
- Throws:
StandardException
- Thrown on failure
-
getSPSDescriptorIndex2Scan
Scan sysstatements_index2 (stmtid) for a match. Note that we do not do a lookup of parameter info.- Returns:
- SPSDescriptor The matching descriptor, if any.
- Throws:
StandardException
- Thrown on failure
-
getSPSDescriptor
public SPSDescriptor getSPSDescriptor(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:
getSPSDescriptor
in interfaceDataDictionary
- Parameters:
stmtName
- the statement namesd
- The SchemaDescriptor- Returns:
- The SPSDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getSPSDescriptorIndex1Scan
private SPSDescriptor getSPSDescriptorIndex1Scan(String stmtName, String schemaUUID) throws StandardException Scan sysschemas_index1 (stmtname, schemaid) for a match.- Returns:
- SPSDescriptor The matching descriptor, if any.
- 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:
addSPSDescriptor
in interfaceDataDictionary
- Parameters:
descriptor
- The descriptor to addtc
- The transaction controller- Throws:
StandardException
- Thrown on error
-
addSPSParams
Add a column in SYS.SYSCOLUMNS for each parameter in the parameter list.- Throws:
StandardException
-
getSPSParams
public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, List<DataValueDescriptor> defaults) throws StandardException Get all the parameter descriptors for an SPS. Look up the params in SYSCOLUMNS and turn them into parameter descriptors.- Specified by:
getSPSParams
in 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:
updateSPS
in interfaceDataDictionary
- Parameters:
spsd
- The descriptor to addtc
- The transaction controllerrecompile
- Whether to recompile or invalidate- Throws:
StandardException
- Thrown on error
-
invalidateAllSPSPlans
Description copied from interface:DataDictionary
Invalidate all the stored plans in SYS.SYSSTATEMENTS.- Specified by:
invalidateAllSPSPlans
in interfaceDataDictionary
- Throws:
StandardException
- Thrown on error- See Also:
-
invalidateAllSPSPlans
Description copied from interface:DataDictionary
Invalidate all the stored plans in SYS.SYSSTATEMENTS for the given language connection context.- Specified by:
invalidateAllSPSPlans
in interfaceDataDictionary
- Throws:
StandardException
- Thrown on error- See Also:
-
clearSPSPlans
Mark all SPS plans in the data dictionary invalid. This does not invalidate cached plans. This function is for use by the boot-up code.- Throws:
StandardException
- Thrown on error
-
dropSPSDescriptor
public void dropSPSDescriptor(SPSDescriptor descriptor, TransactionController tc) throws StandardException Drops the given SPSDescriptor.- Specified by:
dropSPSDescriptor
in interfaceDataDictionary
- Parameters:
descriptor
- The descriptor to droptc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
dropSPSDescriptor
Drops the given SPSDescriptor.- Specified by:
dropSPSDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- the statement uuidtc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
getAllSPSDescriptors
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:
getAllSPSDescriptors
in interfaceDataDictionary
- Returns:
- the list of descriptors
- Throws:
StandardException
- Thrown on failure
-
getAllConstraintDescriptors
Get every constraint in this database. Note that this list of ConstraintDescriptors is not going to be the same objects that are typically cached off of the table descriptors, so this will most likely instantiate some duplicate objects.- Returns:
- the list of descriptors
- Throws:
StandardException
- Thrown on failure
-
examineTriggerNodeAndCols
public int[] examineTriggerNodeAndCols(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements) throws StandardException 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:
examineTriggerNodeAndCols
in 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.- Returns:
- Transformed trigger action sql
- Throws:
StandardException
-
getTriggerActionString
public String getTriggerActionString(Visitable actionStmt, String oldReferencingName, String newReferencingName, String triggerDefinition, int[] referencedCols, int[] referencedColsInTriggerAction, int actionOffset, TableDescriptor triggerTableDescriptor, int triggerEventMask, boolean createTriggerTime, List<int[]> replacements, int[] cols) throws StandardException Description copied from interface:DataDictionary
This method does the job of transforming the trigger action plan text as shown below. DELETE FROM t WHERE c = old.c turns into DELETE FROM t WHERE c = org.apache.derby.iapi.db.Factory:: getTriggerExecutionContext().getOldRow(). getInt(columnNumberFor'C'inRuntimeResultset); In addition to that, for CREATE TRIGGER time, it does the job of collecting the column positions of columns referenced in trigger action plan through REFERENCEs clause. This information will get saved in SYSTRIGGERS table by the caller in CREATE TRIGGER case. It gets called either 1)at the trigger creation time for row level triggers or 2)if the trigger got invalidated by some other sql earlier and the current sql needs that trigger to fire. For such a trigger firing case, this method will get called only if it is row level trigger with REFERENCES clause. This work was done as part of DERBY-4874. Before DERBY-4874, once the stored prepared statement for trigger action plan was generated, it was never updated ever again. But, one case where the trigger action plan needs to be regenerated is say when the column length is changed for a column which is REFERENCEd as old or new column value. eg of such a case would be say the Alter table has changed the length of a varchar column from varchar(30) to varchar(64) but the stored prepared statement associated with the trigger action plan continued to use varchar(30). To fix varchar(30) in stored prepared statement for trigger action sql to varchar(64), we need to regenerate the trigger action sql. This new trigger action sql will then get updated into SYSSTATEMENTS table. If we are here for case 1) above, then we will collect all column references in trigger action through new/old transition variables. Information about them will be saved in SYSTRIGGERS table DERBY-1482 (if we are dealing with pre-10.7 db, then we will not put any information about trigger action columns in the system table to ensure backward compatibility). This information along with the trigger columns will decide what columns from the trigger table will be fetched into memory during trigger execution. If we are here for case 2) above, then all the information about column references in trigger action has already been collected during CREATE TRIGGER time and hence we can use that available information about column positions to do the transformation of OLD/NEW transient references. More information on case 1) above. DERBY-1482 One of the work done by this method for row level triggers is to find the columns which are referenced in the trigger action through the REFERENCES clause ie thro old/new transition variables. This information will be saved in SYSTRIGGERS so it can be retrieved during the trigger execution time. The purpose of this is to recognize what columns from the trigger table should be read in during trigger execution. Before these code changes, during trigger execution, Derby was opting to read all the columns from the trigger table even if they were not all referenced during the trigger execution. This caused Derby to run into OOM at times when it could really be avoided. We go through the trigger action text and collect the column positions of all the REFERENCEd columns through new/old transition variables. We keep that information in SYSTRIGGERS. At runtime, when the trigger is fired, we will look at this information along with trigger columns from the trigger definition and only fetch those columns into memory rather than all the columns from the trigger table. This is especially useful when the table has LOB columns and those columns are not referenced in the trigger action and are not recognized as trigger columns. For such cases, we can avoid reading large values of LOB columns into memory and thus avoiding possibly running into OOM errors. If there are no trigger columns defined on the trigger, we will read all the columns from the trigger table when the trigger fires because no specific columns were identified as trigger column by the user. The other case where we will opt to read all the columns are when trigger columns and REFERENCING clause is identified for the trigger but there is no trigger action column information in SYSTRIGGERS. This can happen for triggers created prior to 10.7 release and later that database got hard/soft-upgraded to 10.7 or higher release.- Specified by:
getTriggerActionString
in 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 howtriggerDefinition
has been transformed into the returned SQL text. Each element in the list will contain four integers. The first two describe the begin and end offset of the replaced text in thetriggerDefinition
. The last two describe the begin and end offset of the replacement text in the returned string. The begin offsets are inclusive, whereas the end offsets are exclusive. The list can benull
if the caller does not care about this information.- Returns:
- Transformed trigger action sql
- Throws:
StandardException
-
getTransitionVariables
private static SortedSet<ColumnReference> getTransitionVariables(Visitable node, String oldReferencingName, String newReferencingName) throws StandardException Get all columns that reference transition variables in triggers. The columns should be returned in the same order as in the SQL text.- Parameters:
node
- the node in which to look for transition variablesoldReferencingName
- the name of the old transition variablenewReferencingName
- the name of the new transition variable- Returns:
- all references to transition variables
- Throws:
StandardException
-
isTransitionVariable
private static boolean isTransitionVariable(TableName tableName, String oldReferencingName, String newReferencingName) Check if a table name is actually a transition variable.- Parameters:
tableName
- the table name to checkoldReferencingName
- the name of the old transition variablenewReferencingName
- the name of the new transition variable- Returns:
true
if the table name is a transition variable,false
otherwise
-
justTheRequiredColumns
-
checkInvalidTriggerReference
private void checkInvalidTriggerReference(String tableName, String oldReferencingName, String newReferencingName, int triggerEventMask) throws StandardException - Throws:
StandardException
-
genColumnReferenceSQL
private String genColumnReferenceSQL(TableDescriptor td, String colName, String tabName, boolean isOldTable, int colPositionInRuntimeResultSet) throws StandardException - Throws:
StandardException
-
getTriggerDescriptor
Get a TriggerDescriptor given its UUID.- Specified by:
getTriggerDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- The UUID- Returns:
- The TriggerDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getTriggerDescriptor
public TriggerDescriptor getTriggerDescriptor(String name, SchemaDescriptor sd) throws StandardException Get the stored prepared statement descriptor given a sps name.- Specified by:
getTriggerDescriptor
in interfaceDataDictionary
- Parameters:
name
- The sps name.sd
- The schema descriptor.- Returns:
- The TriggerDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getTriggerDescriptors
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:
getTriggerDescriptors
in interfaceDataDictionary
- Parameters:
td
- The table descriptor.- Returns:
- The ConstraintDescriptorList for the table
- Throws:
StandardException
- Thrown on failure
-
getTriggerDescriptorsScan
private void getTriggerDescriptorsScan(TableDescriptor td, boolean forUpdate) throws StandardException Populate the TriggerDescriptorList for the specified TableDescriptor. MT synchronization: it is assumed that the caller has synchronized on the CDL in the given TD.- Parameters:
td
- The TableDescriptor.forUpdate
- Whether or not to open scan for update- 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:
dropTriggerDescriptor
in 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:
updateTriggerDescriptor
in 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
Get a ConstraintDescriptor given its UUID. Please use getConstraintDescriptorById() is you have the constraints table descriptor, it is much faster.- Specified by:
getConstraintDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- The UUID- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getConstraintDescriptor
public ConstraintDescriptor getConstraintDescriptor(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:
getConstraintDescriptor
in interfaceDataDictionary
- Parameters:
constraintName
- Constraint name.schemaID
- The schema UUID- Returns:
- The ConstraintDescriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
getStatisticsDescriptors
public 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:
getStatisticsDescriptors
in interfaceDataDictionary
- Parameters:
td
-TableDescriptor
for 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:
getConstraintDescriptors
in 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:
getActiveConstraintDescriptors
in 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
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:
activeConstraint
in 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:
getConstraintDescriptor
in 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:
getConstraintDescriptorById
in 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, String constraintName, boolean forUpdate) throws StandardException Get the constraint descriptor given a TableDescriptor and the constraint name.- Specified by:
getConstraintDescriptorByName
in 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
-
getConstraintDescriptorsScan
private void getConstraintDescriptorsScan(TableDescriptor td, boolean forUpdate) throws StandardException Populate the ConstraintDescriptorList for the specified TableDescriptor. MT synchronization: it is assumed that the caller has synchronized on the CDL in the given TD.- Parameters:
td
- The TableDescriptor.forUpdate
- Whether or not to open scan for update- Throws:
StandardException
- Thrown on failure
-
getConstraintDescriptorViaIndex
protected ConstraintDescriptor getConstraintDescriptorViaIndex(int indexId, ExecIndexRow keyRow, TabInfoImpl ti, TableDescriptor td, ConstraintDescriptorList dList, boolean forUpdate) throws StandardException Return a (single or list of) ConstraintDescriptor(s) from SYSCONSTRAINTS where the access is from the index to the heap.- Parameters:
indexId
- The id of the index (0 to # of indexes on table) to usekeyRow
- The supplied ExecIndexRow for searchti
- The TabInfoImpl to usetd
- The TableDescriptor, if supplied.dList
- The list to build, if supplied. If null, then caller expects a single descriptorforUpdate
- Whether or not to open scan for update- Returns:
- The last matching descriptor
- Throws:
StandardException
- Thrown on error
-
getConstraintDescriptorViaHeap
protected TupleDescriptor getConstraintDescriptorViaHeap(ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, ConstraintDescriptorList list) throws StandardException Return a (single or list of) catalog row descriptor(s) from SYSCONSTRAINTS through a heap scan- Parameters:
scanQualifiers
- qualifiersti
- The TabInfoImpl to useparentTupleDescriptor
- The parentDescriptor, if applicable.list
- The list to build, if supplied. If null, then caller expects a single descriptor- Returns:
- The last matching descriptor
- Throws:
StandardException
- Thrown on error
-
getConstraintTableDescriptor
Return a table descriptor corresponding to the TABLEID field in SYSCONSTRAINTS where CONSTRAINTID matches the constraintId passsed in.- Specified by:
getConstraintTableDescriptor
in interfaceDataDictionary
- Parameters:
constraintId
- The id of the constraint- Returns:
- the corresponding table descriptor
- Throws:
StandardException
- Thrown on error
-
getForeignKeys
Return a list of foreign keys constraints referencing this constraint. Returns both enforced and not enforced foreign keys.- Specified by:
getForeignKeys
in interfaceDataDictionary
- Parameters:
constraintId
- The id of the referenced constraint- Returns:
- list of constraints, empty of there are none
- Throws:
StandardException
- Thrown on error
-
getConstraints
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:
addConstraintDescriptor
in 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:
updateConstraintDescriptor
in interfaceDataDictionary
- Parameters:
cd
- The Constraint descriptorformerUUID
- The UUID for this column in SYSCONSTRAINTS, may differ from what is incd
if 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:
dropConstraintDescriptor
in 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:
dropAllConstraintDescriptors
in 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:
getSubKeyConstraint
in 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
-
addSubKeyConstraint
private void addSubKeyConstraint(KeyConstraintDescriptor descriptor, TransactionController tc) throws StandardException Add the matching row to syskeys when adding a unique or primary key constraint- Parameters:
descriptor
- The KeyConstraintDescriptor for the constraint.tc
- The TransactionController- Throws:
StandardException
- Thrown on failure
-
dropSubKeyConstraint
private void dropSubKeyConstraint(ConstraintDescriptor constraint, TransactionController tc) throws StandardException Drop the matching row from syskeys when dropping a primary key or unique constraint.- Parameters:
constraint
- the constrainttc
- The TransactionController- Throws:
StandardException
- Thrown on failure
-
getSubCheckConstraint
private SubCheckConstraintDescriptor getSubCheckConstraint(UUID constraintId) throws StandardException Get a SubCheckConstraintDescriptor from syschecks for the specified constraint id. (Useful for check constraints.)- Parameters:
constraintId
- The UUID for the constraint.- Returns:
- SubCheckConstraintDescriptor The Sub descriptor for the constraint.
- Throws:
StandardException
- Thrown on failure
-
dropSubCheckConstraint
private void dropSubCheckConstraint(UUID constraintId, TransactionController tc) throws StandardException Drop the matching row from syschecks when dropping a check constraint.- Parameters:
constraintId
- The constraint id.tc
- The TransactionController- Throws:
StandardException
- Thrown on failure
-
hashAllConglomerateDescriptorsByNumber
public Hashtable<Long,ConglomerateDescriptor> hashAllConglomerateDescriptorsByNumber(TransactionController tc) throws StandardException Get all of the ConglomerateDescriptors in the database and hash them by conglomerate number. This is useful as a performance optimization for the locking VTIs. NOTE: This method will scan SYS.SYSCONGLOMERATES at READ UNCOMMITTED.- Specified by:
hashAllConglomerateDescriptorsByNumber
in 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 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:
hashAllTableDescriptorsByTableId
in 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
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:
getConglomerateDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- The UUID- Returns:
- A ConglomerateDescriptor for the conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptors
Get an array of ConglomerateDescriptors given the UUID. If it is a heap conglomerate or an index conglomerate not shared by a duplicate index, the size of the return array is 1. If the uuid argument is null, then this method retrieves descriptors for all of the conglomerates in the database.- Specified by:
getConglomerateDescriptors
in 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:
getConglomerateDescriptor
in 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:
getConglomerateDescriptors
in 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
-
getConglomerateDescriptorsScan
Populate the ConglomerateDescriptorList for the specified TableDescriptor by scanning sysconglomerates. MT synchronization: it is assumed that the caller has synchronized on the CDL in the given TD.- Parameters:
td
- The TableDescriptor.- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptor
public ConglomerateDescriptor getConglomerateDescriptor(String indexName, SchemaDescriptor sd, boolean forUpdate) throws StandardException Gets a conglomerate descriptor for the named index in the given schema, getting an exclusive row lock on the matching row in sys.sysconglomerates (for DDL concurrency) if requested.- Specified by:
getConglomerateDescriptor
in 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:
dropConglomerateDescriptor
in 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:
dropAllConglomerateDescriptors
in 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:
updateConglomerateDescriptor
in interfaceDataDictionary
- Parameters:
cd
- The ConglomerateDescriptorconglomerateNumber
- The new conglomerate numbertc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
updateSystemSchemaAuthorization
public void updateSystemSchemaAuthorization(String aid, TransactionController tc) throws StandardException Update 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(String schemaName, String authorizationId, TransactionController tc) throws StandardException Update 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:
updateConglomerateDescriptor
in interfaceDataDictionary
- Parameters:
cds
- The array of ConglomerateDescriptorsconglomerateNumber
- The new conglomerate numbertc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
getDependentsDescriptorList
public List<DependencyDescriptor> getDependentsDescriptorList(String dependentID) throws StandardException Gets a list of the dependency descriptors for the given dependent's id.- Specified by:
getDependentsDescriptorList
in 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 List<DependencyDescriptor> getProvidersDescriptorList(String providerID) throws StandardException Gets a list of the dependency descriptors for the given provider's id.- Specified by:
getProvidersDescriptorList
in 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
Build and return an List with DependencyDescriptors for all of the stored dependencies. This is useful for consistency checking.- Specified by:
getAllDependencyDescriptorsList
in 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:
dropStoredDependency
in 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:
dropDependentsStoredDependencies
in 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:DataDictionary
Remove all of the stored dependencies for a given dependent's ID from the data dictionary.- Specified by:
dropDependentsStoredDependencies
in 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
Get the UUID Factory. (No need to make the UUIDFactory a module.)- Specified by:
getUUIDFactory
in 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:
getAliasDescriptorForUDT
in 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
Get a AliasDescriptor given its UUID.- Specified by:
getAliasDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- The UUID- Returns:
- The AliasDescriptor for the alias.
- Throws:
StandardException
- Thrown on failure
-
getAliasDescriptor
public AliasDescriptor getAliasDescriptor(String schemaId, String aliasName, char nameSpace) throws StandardException Get a AliasDescriptor by alias name and name space. NOTE: caller responsible for handling no match.- Specified by:
getAliasDescriptor
in 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 List<AliasDescriptor> getRoutineList(String schemaID, 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:
getRoutineList
in interfaceDataDictionary
- Throws:
StandardException
-
dropAliasDescriptor
public void dropAliasDescriptor(AliasDescriptor ad, TransactionController tc) throws StandardException Drop a AliasDescriptor from the DataDictionary- Specified by:
dropAliasDescriptor
in 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:DataDictionary
Update a user. Changes all columns in the corresponding SYSUSERS row except for the user name.- Specified by:
updateUser
in interfaceDataDictionary
- Parameters:
newDescriptor
- New values for columns in the SYSUSERS row.tc
- The TransactionController to use- Throws:
StandardException
- Thrown on failure
-
getUser
Description copied from interface:DataDictionary
Return the credentials descriptor for the named user.- Specified by:
getUser
in interfaceDataDictionary
- Parameters:
userName
- Name of the user whose credentials we want.- Throws:
StandardException
- Thrown on failure
-
dropUser
Description copied from interface:DataDictionary
Drop a User from the DataDictionary- Specified by:
dropUser
in interfaceDataDictionary
- Parameters:
userName
- The user to drop.tc
- The TransactionController- Throws:
StandardException
- Thrown on failure
-
loadDictionaryTables
private void loadDictionaryTables(TransactionController tc, Properties startParams) throws StandardException Initialize system catalogs. This is where we perform upgrade. It is our pious hope that we won't ever have to upgrade the core catalogs, other than to add fields inside Formatable columns in these catalogs. If we do have to upgrade the core catalogs, then we may need to move the loadCatalog calls into the upgrade machinery. It's do-able, just not pretty.- Parameters:
tc
- TransactionController- Throws:
StandardException
- Thrown on error
-
resetDatabaseOwner
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
-
loadCatalogs
Initialize indices for an array of catalogs- Throws:
StandardException
- Thrown on error
-
createDictionaryTables
protected void createDictionaryTables(Properties params, TransactionController tc, DataDescriptorGenerator ddg) throws StandardException Create all the required dictionary tables. Any classes that extend this class and need to create new tables should override this method, and then call this method as the first action in the new method, e.g.protected Configuration createDictionaryTables(Configuration cfg, TransactionController tc, DataDescriptorGenerator ddg) throws StandardException { super.createDictionaryTables(params, tc, ddg); ... }
- Throws:
StandardException
- Standard Derby error policy
-
addSystemSchema
private SchemaDescriptor addSystemSchema(String schema_name, String schema_uuid, TransactionController tc) throws StandardException Add a system schema to the database.- Parameters:
schema_name
- name of the schema to add.- Throws:
StandardException
- Standard exception policy.
-
upgradeMakeCatalog
protected void upgradeMakeCatalog(TransactionController tc, int catalogNumber) throws StandardException called by the upgrade code (dd_xena etc) to add a new system catalog.- Parameters:
tc
- TransactionController to use.catalogNumber
- catalogNumber- Throws:
StandardException
-
upgradeJarStorage
Called by the upgrade code to upgrade the way we store jar files in the database. We now use UUID as part of the file name to avoid problems with path delimiters. Also, we henceforth use no schema subdirectories since there is no chance of name collision with the UUID.- Parameters:
tc
- TransactionController to use.- Throws:
StandardException
-
makeCatalog
private void makeCatalog(TabInfoImpl ti, SchemaDescriptor sd, TransactionController tc) throws StandardException The dirty work of creating a catalog.- Parameters:
ti
- TabInfoImpl describing catalog to create.sd
- Schema to create catalogs in.tc
- Transaction context.- Throws:
StandardException
- Standard Derby error policy
-
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_SYSCOLUMNS_AUTOINCCYCLE
Add autoinccycle columns to an SYSCOLUMNS system catalog- Parameters:
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
-
widenConglomerate
private void widenConglomerate(ExecRow templateRow, int[] newColumnIDs, long conglomID, TransactionController tc) throws StandardException Adds columns to the conglomerate underlying a system table.- Parameters:
templateRow
- Ultimate shape of base row of tablenewColumnIDs
- Array of 1-based column idsconglomID
- heap idtc
- Transaction controller- Throws:
StandardException
- Standard Derby error policy
-
getUUIDForCoreTable
private UUID getUUIDForCoreTable(String tableName, String schemaUUID, TransactionController tc) throws StandardException Get the UUID for the specified system table. Prior to Plato, system tables did not have canonical UUIDs, so we need to scan systables to get the UUID when we are updating the core tables.- Parameters:
tableName
- Name of the tableschemaUUID
- UUID of schematc
- TransactionController to user- Returns:
- UUID The UUID of the core table.
- Throws:
StandardException
- Thrown on failure
-
upgrade_initSystemTableCols
void upgrade_initSystemTableCols(TransactionController tc, boolean isCoreTable, int tableNum, FormatableBitSet columnsToUpdateSet, DataValueDescriptor[] replaceRow) throws StandardException Initialize noncore columns to fixed values- Parameters:
tc
- The TransactionController for the transaction to do the upgrade in.isCoreTable
- true if it is a core tabletableNum
- the noncore table numbercolumnsToUpdateSet
- a bit set of columns to update. ZERO BASEDreplaceRow
- an object array of Orderables for the new values- Throws:
StandardException
- Thrown on error
-
bootStrapSystemIndexes
private void bootStrapSystemIndexes(SchemaDescriptor sd, TransactionController tc, DataDescriptorGenerator ddg, TabInfoImpl ti) throws StandardException Infrastructure work for indexes on catalogs.- Throws:
StandardException
- Standard Derby error policy
-
computeAutoincRowLocations
public RowLocation[] computeAutoincRowLocations(TransactionController tc, TableDescriptor td) throws StandardException Description copied from interface:DataDictionary
returns an array of RowLocations corresponding to the autoincrement columns in the table. The RowLocation points to the row in SYSCOLUMNS for this particular ai column. The array has as many elements as there are columns in the table. If a column is not an ai column, the entry is NULL.- Specified by:
computeAutoincRowLocations
in 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:
-
getSetAutoincrementValue
public NumberDataValue getSetAutoincrementValue(RowLocation rl, TransactionController tc, boolean doUpdate, NumberDataValue newValue, boolean wait) throws StandardException Description copied from interface:DataDictionary
getSetAutoincrementValue fetches the autoincrement value from SYSCOLUMNS given a row location. If doUpdate is true it updates the autoincrement column with the new value. the value returned by this routine is the new value and *NOT* the value in the system catalogs.- Specified by:
getSetAutoincrementValue
in 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:
-
bootstrapOneIndex
private ConglomerateDescriptor bootstrapOneIndex(SchemaDescriptor sd, TransactionController tc, DataDescriptorGenerator ddg, TabInfoImpl ti, int indexNumber, long heapConglomerateNumber) throws StandardException - Throws:
StandardException
-
initSystemIndexVariables
- Throws:
StandardException
-
populateSYSDUMMY1
Populate SYSDUMMY1 table with a single row.- Throws:
StandardException
- Standard Derby error policy
-
clearCaches
Clear all of the DataDictionary caches.- Specified by:
clearCaches
in interfaceDataDictionary
- Throws:
StandardException
- Standard Derby error policy
-
clearCaches
Clear the DataDictionary caches, including the sequence caches if requested..- Specified by:
clearCaches
in interfaceDataDictionary
- Throws:
StandardException
- Standard Derby error policy
-
clearSequenceCaches
Flush sequence caches to disk so that we don't leak unused, pre-allocated numbers.- Specified by:
clearSequenceCaches
in interfaceDataDictionary
- Throws:
StandardException
- Standard Derby error policy
-
addSystemTableToDictionary
private void addSystemTableToDictionary(TabInfoImpl ti, SchemaDescriptor sd, TransactionController tc, DataDescriptorGenerator ddg) throws StandardException Add the required entries to the data dictionary for a System table.- Throws:
StandardException
-
makeColumnDescriptor
private ColumnDescriptor makeColumnDescriptor(SystemColumn column, int columnPosition, TableDescriptor td) throws StandardException Converts a SystemColumn to a ColumnDescriptor.- Parameters:
column
- a SystemColumncolumnPosition
- Position of the column in the table, one based.td
- descriptor for table that column lives in- Returns:
- a ColumnDes*criptor
- Throws:
StandardException
- Standard Derby error policy
-
createConglomerate
private long createConglomerate(String name, TransactionController tc, ExecRow rowTemplate, Properties properties) throws StandardException Create a conglomerate for a system table- Parameters:
name
- Name of new catalog.tc
- Transaction context.rowTemplate
- Template for rows for the new tableproperties
- Properties for createConglomerate- Returns:
- Conglomerate id.
- Throws:
StandardException
- Standard Derby error policy.
-
getIDValueAsCHAR
Converts a UUID to an DataValueDescriptor.- Returns:
- the UUID converted to an DataValueDescriptor
-
initializeCatalogInfo
Initialize catalog information. This method is overridden by children.- Throws:
StandardException
- Thrown on error
-
initializeCoreInfo
Initialized the core info array.- Throws:
StandardException
-
initializeNoncoreInfo
private void initializeNoncoreInfo()Initialized the noncore info array. -
getTransactionCompile
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
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
-
getDescriptorViaIndex
private <T extends TupleDescriptor> T getDescriptorViaIndex(int indexId, ExecIndexRow keyRow, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType, boolean forUpdate) throws StandardException Return a (single or list of) catalog row descriptor(s) from a system table where the access is from the index to the heap.- Parameters:
indexId
- The id of the index (0 to # of indexes on table) to usekeyRow
- The supplied ExecIndexRow for searchti
- The TabInfoImpl to useparentTupleDescriptor
- The parentDescriptor, if applicable.list
- The list to build, if supplied. If null, then caller expects a single descriptorreturnType
- The type of descriptor to returnforUpdate
- Whether or not to open the index for update.- Returns:
- The last matching descriptor
- Throws:
StandardException
- Thrown on error
-
getDescriptorViaIndex
private <T extends TupleDescriptor> T getDescriptorViaIndex(int indexId, ExecIndexRow keyRow, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType, boolean forUpdate, int isolationLevel, TransactionController tc) throws StandardException Return a (single or list of) catalog row descriptor(s) from a system table where the access is from the index to the heap. This overload variant takes an explicit tc, in contrast to the normal one which uses the one returned by getTransactionCompile.- Parameters:
indexId
- The id of the index (0 to # of indexes on table) to usekeyRow
- The supplied ExecIndexRow for searchti
- The TabInfoImpl to useparentTupleDescriptor
- The parentDescriptor, if applicable.list
- The list to build, if supplied. If null, then caller expects a single descriptorreturnType
- The type of descriptor to returnforUpdate
- Whether or not to open the index for update.isolationLevel
- 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 last matching descriptor. If isolationLevel is ISOLATION_READ_UNCOMMITTED, the base row may be gone by the time we access it via the index; in such a case a null is returned.
- Throws:
StandardException
- Thrown on error.
-
getDescriptorViaIndexMinion
private <T extends TupleDescriptor> T getDescriptorViaIndexMinion(int indexId, ExecIndexRow keyRow, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType, boolean forUpdate, int isolationLevel, TransactionController tc) throws StandardException - Throws:
StandardException
-
debugGenerateInfo
private void debugGenerateInfo(StringBuffer strbuf, TransactionController tc, ConglomerateController heapCC, TabInfoImpl ti, int indexId) -
getDescriptorViaHeap
protected <T extends TupleDescriptor> T getDescriptorViaHeap(FormatableBitSet columns, ScanQualifier[][] scanQualifiers, TabInfoImpl ti, TupleDescriptor parentTupleDescriptor, List<? super T> list, Class<T> returnType) throws StandardException Return a (single or list of) catalog row descriptor(s) from a system table where the access a heap scan- Parameters:
columns
- which columns to fetch from the system table, or null to fetch all columnsscanQualifiers
- qualifiersti
- The TabInfoImpl to useparentTupleDescriptor
- The parentDescriptor, if applicable.list
- The list to build, if supplied. If null, then caller expects a single descriptorreturnType
- The type of descriptor to look for- Returns:
- The last matching descriptor
- Throws:
StandardException
- Thrown on error
-
getNonCoreTI
Get a TabInfoImpl for a non-core table. (We fault in information about non-core tables as needed.)- Parameters:
catalogNumber
- The index into noncoreTable[].- Throws:
StandardException
- Thrown on error
-
getNonCoreTIByNumber
returns the tabinfo for a non core system catalog. Input is a catalogNumber (defined in DataDictionary).- Throws:
StandardException
-
initSystemIndexVariables
- Throws:
StandardException
-
clearNoncoreTable
private void clearNoncoreTable(int nonCoreNum) -
faultInTabInfo
Finishes building a TabInfoImpl if it hasn't already been faulted in. NOP if TabInfoImpl has already been faulted in.- Parameters:
ti
- TabInfoImpl to fault in.- 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:
getEngineType
in 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.
-
addSYSCOLUMNSIndex2Property
-
getBootParameter
private long getBootParameter(Properties startParams, String key, boolean required) throws StandardException - Throws:
StandardException
-
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:
getSystemSQLName
in interfaceDataDictionary
- Returns:
- system generated unique name
-
twoDigits
-
setAutoincrementValue
public void setAutoincrementValue(TransactionController tc, UUID tableUUID, String columnName, long aiValue, boolean incrementNeeded) throws StandardException sets a new value in SYSCOLUMNS for a particular autoincrement column.- Specified by:
setAutoincrementValue
in interfaceDataDictionary
- Parameters:
tc
- Transaction Controller to use.tableUUID
- Table DescriptorcolumnName
- 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.- Throws:
StandardException
-
computeRowLocation
private RowLocation computeRowLocation(TransactionController tc, TableDescriptor td, String columnName) throws StandardException Computes the RowLocation in SYSCOLUMNS for a particular autoincrement column.- Parameters:
tc
- Transaction Controller to use.td
- Table Descriptor.columnName
- Name of column which has autoincrement column.- Throws:
StandardException
- thrown on failure.
-
computeSequenceRowLocation
public void computeSequenceRowLocation(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) throws StandardException Computes the RowLocation in SYSSEQUENCES for a particular sequence. Also constructs the sequence descriptor.- Specified by:
computeSequenceRowLocation
in 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, Long oldValue, Long newValue) throws StandardException Set the current value of an ANSI/ISO sequence. This method does not perform any sanity checking but assumes that the caller knows what they are doing. If the old value on disk is not what we expect it to be, then we are in a race with another session. They won and we don't update the value on disk. However, if the old value is null, that is a signal to us that we should update the value on disk anyway.- Specified by:
updateCurrentSequenceValue
in 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(String sequenceUUIDstring, NumberDataValue returnValue) throws StandardException Description copied from interface:DataDictionary
Get the next number from an ANSI/ISO sequence generator which was created with the CREATE SEQUENCE statement. May raise an exception if the sequence was defined as NO CYCLE and the range of the sequence is exhausted. May allocate a range of sequence numbers and update the CURRENTVALUE column of the corresponding row in SYSSEQUENCES. This work is done in the execution transaction of the current session.- Specified by:
getCurrentValueAndAdvance
in 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:
-
peekAtIdentity
Description copied from interface:DataDictionary
Peek at the next value which will be returned by an identity generator.
- Specified by:
peekAtIdentity
in interfaceDataDictionary
- Throws:
StandardException
-
peekAtSequence
Description copied from interface:DataDictionary
Peek at the next value which will be returned by a sequence generator.
- Specified by:
peekAtSequence
in interfaceDataDictionary
- Throws:
StandardException
-
getBulkInsertCounter
public BulkInsertCounter getBulkInsertCounter(String sequenceUUIDString, boolean restart) throws StandardException Description copied from interface:DataDictionary
Get the identity generator used to support the bulk-insert optimization in InsertResultSet.- Specified by:
getBulkInsertCounter
in 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(String sequenceUUIDString, BulkInsertCounter bic) throws StandardException Description copied from interface:DataDictionary
Flush the updated values of the BulkInsertCounter to disk and to the original, cached SequenceUpdater. This is used for the bulk-insert optimization in InsertResultSet.- Specified by:
flushBulkInsertCounter
in 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:
getRowLocationTemplate
in 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:DataDictionary
Drops all statistics descriptors for a given table/index column combination. If the index is not specified, then all statistics for the table are dropped.- Specified by:
dropStatisticsDescriptors
in interfaceDataDictionary
- Parameters:
tableUUID
- UUID of the tablereferenceUUID
- UUID of the index. This can be null.tc
- Transcation Controller to use.- Throws:
StandardException
- See Also:
-
getLCC
-
newSystemSchemaDesc
-
newDeclaredGlobalTemporaryTablesSchemaDesc
-
checkVersion
Check to see if a database has been upgraded to the required level in order to use a language feature.- Specified by:
checkVersion
in 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:DataDictionary
Check if the database is read only and requires some form of upgrade that makes the stored prepared statements invalid.- Specified by:
isReadOnlyUpgrade
in interfaceDataDictionary
- Returns:
true
if the stored prepared statements are invalid because of an upgrade and the database is read only,false
otherwise
-
setReadOnlyUpgrade
void setReadOnlyUpgrade()Mark this database as a read only database whose stored prepared statements are invalid because some kind of upgrade is needed. -
createSystemSps
Create system built-in metadata stored prepared statements.- Throws:
StandardException
-
createSPSSet
protected void createSPSSet(TransactionController tc, boolean net, UUID schemaID) throws StandardException Create a set of stored prepared statements from a properties file. Key is the statement name, value is the SQL statement.- Throws:
StandardException
-
createSystemProcedureOrFunction
private final UUID createSystemProcedureOrFunction(String routine_name, UUID schema_uuid, String[] arg_names, TypeDescriptor[] arg_types, int num_out_param, int num_result_sets, short routine_sql_control, boolean isDeterministic, boolean hasVarargs, TypeDescriptor return_type, HashSet<String> newlyCreatedRoutines, TransactionController tc, String procClass) throws StandardException Generic create procedure routine.Takes the input procedure and inserts it into the appropriate catalog. Assumes all arguments are "IN" type.
- Parameters:
routine_name
- name of the routine in java and the SQL procedure name.arg_names
- String array of procedure argument names in order.arg_types
- Internal SQL types of the argumentsroutine_sql_control
- One of the RoutineAliasInfo constants: MODIFIES_SQL_DATA READS_SQL_DATA CONTAINS_SQL NO_SQLisDeterministic
- True if the procedure/function is DETERMINISTICreturn_type
- null for procedure. For functions the return type of the function.newlyCreatedRoutines
- evolving set of routines, some of which may need permissions later ontc
- an instance of the TransactionControllerprocClass
- the fully qualified name of the class that contains java definitions for the stored procedures- Returns:
- UUID UUID of system routine that got created.
- Throws:
StandardException
- Standard exception policy.
-
createSystemProcedureOrFunction
private final UUID createSystemProcedureOrFunction(String routine_name, UUID schema_uuid, String[] arg_names, TypeDescriptor[] arg_types, int num_out_param, int num_result_sets, short routine_sql_control, boolean isDeterministic, boolean hasVarargs, TypeDescriptor return_type, HashSet<String> newlyCreatedRoutines, TransactionController tc) throws StandardException Generic create procedure routine. Takes the input procedure and inserts it into the appropriate catalog. Assumes all arguments are "IN" type.- Parameters:
routine_name
- name of the routine in java and the SQL procedure name.arg_names
- String array of procedure argument names in order.arg_types
- Internal SQL types of the argumentsroutine_sql_control
- One of the RoutineAliasInfo constants: MODIFIES_SQL_DATA READS_SQL_DATA CONTAINS_SQL NO_SQLisDeterministic
- True if the procedure/function is DETERMINISTICreturn_type
- null for procedure. For functions the return type of the function.newlyCreatedRoutines
- evolving set of routines, some of which may need permissions later ontc
- an instance of the TransactionController- Returns:
- UUID UUID of system routine that got created.
- Throws:
StandardException
- Standard exception policy.
-
create_SYSCS_procedures
private final void create_SYSCS_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system proceduresUsed to add the system procedures to the database when it is created. System procedures are currently added to either SYSCS_UTIL or SQLJ schemas.
- Parameters:
tc
- transaction controller to use. Counts on caller to commit.newlyCreatedRoutines
- evolving set of routines which may need to be given permissions later on- Throws:
StandardException
- Standard exception policy.
-
create_SYSIBM_procedures
protected final void create_SYSIBM_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures in SYSIBMUsed to add the system procedures to the database when it is created. Full upgrade from version 5.1 or earlier also calls this method.
- Parameters:
tc
- transaction controller to use. Counts on caller to commit.newlyCreatedRoutines
- evolving set of routines which we're adding (some may need permissions later on)- Throws:
StandardException
- Standard exception policy.
-
grantPublicAccessToSystemRoutines
public void grantPublicAccessToSystemRoutines(HashSet newlyCreatedRoutines, TransactionController tc, String authorizationID) throws StandardException Grant 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.
-
grantPublicAccessToSystemRoutine
private void grantPublicAccessToSystemRoutine(String schemaID, String routineName, char nameSpace, TransactionController tc, String authorizationID) throws StandardException Grant PUBLIC access to a system routine. This method should be used only for granting access to a system routine (other than routines in SYSFUN schema). It expects the routine to be present in SYSALIASES catalog.- Parameters:
schemaID
- Schema IDroutineName
- Routine NamenameSpace
- Indicates whether the routine is a function/procedure.tc
- TransactionController to useauthorizationID
- authorization ID of the permission grantor- Throws:
StandardException
- Standard exception policy.
-
createRoutinePermPublicDescriptor
void createRoutinePermPublicDescriptor(UUID routineUUID, TransactionController tc, String authorizationID) throws StandardException Create RoutinePermDescriptor to grant access to PUBLIC for this system routine using the grantor specified in authorizationID.- Parameters:
routineUUID
- uuid of the routinetc
- TransactionController to useauthorizationID
- authorization ID of the permission grantor- Throws:
StandardException
- Standard exception policy.
-
create_10_1_system_procedures
void create_10_1_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines, UUID sysUtilUUID) throws StandardException Create system procedures added in version 10.1.Create 10.1 system procedures, called by either code creating new database, or code doing hard upgrade from previous version.
- Parameters:
tc
- booting transactionnewlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)sysUtilUUID
- uuid of the SYSUTIL schema.- Throws:
StandardException
- Standard exception policy.
-
create_10_2_system_procedures
void create_10_2_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines, UUID sysUtilUUID) throws StandardException Create system procedures added in version 10.2.Create 10.2 system procedures, called by either code creating new database, or code doing hard upgrade from previous version.
- Parameters:
tc
- booting transactionnewlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)sysUtilUUID
- uuid of the SYSUTIL schema.- Throws:
StandardException
- Standard exception policy.
-
create_10_3_system_procedures_SYSIBM
private void create_10_3_system_procedures_SYSIBM(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures added in version 10.3. Create 10.3 system procedures related to the LOB Methods , called by either code creating new database, or code doing hard upgrade from previous version.- Parameters:
tc
- an instance of the TransactionController class.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
- Standard exception policy.
-
create_10_5_system_procedures
void create_10_5_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create the System procedures that are added to 10.5.- Parameters:
tc
- an instance of the TransactionController.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
- Standard exception policy.
-
create_10_6_system_procedures
void create_10_6_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create the System procedures that are added to 10.6.- Parameters:
tc
- an instance of the TransactionController.- Throws:
StandardException
- Standard exception policy.
-
create_10_3_system_procedures
void create_10_3_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create the System procedures that are added in 10.3.- Parameters:
tc
- an instance of the TransactionController.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
- Standard exception policy.
-
create_10_3_system_procedures_SYSCS_UTIL
void create_10_3_system_procedures_SYSCS_UTIL(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures that are part of the SYSCS_UTIL schema added in version 10.3.Create 10.3 system procedures, called by either code creating new database, or code doing hard upgrade from previous version.
- Parameters:
tc
- an instance of the Transaction Controller.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
- Standard exception policy.
-
create_10_9_system_procedures
void create_10_9_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures that are part of the SYSCS_UTIL schema added in version 10.9. These include the procedures for managing NATIVE credentials. See DERBY-866.
- Parameters:
tc
- an instance of the Transaction Controller.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
-
create_10_10_system_procedures
void create_10_10_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.10.
- Parameters:
tc
- an instance of the Transaction Controller.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
-
create_10_11_system_procedures
void create_10_11_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.11.
- Parameters:
tc
- an instance of the Transaction Controller.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
-
create_10_12_system_procedures
void create_10_12_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.12.
- Parameters:
tc
- an instance of the Transaction Controller.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
-
create_10_13_system_procedures
void create_10_13_system_procedures(TransactionController tc, HashSet<String> newlyCreatedRoutines) throws StandardException Create system procedures that are part of the SYSCS_UTIL schema, added in version 10.13.
- Parameters:
tc
- an instance of the Transaction Controller.newlyCreatedRoutines
- set of routines we are creating (used to add permissions later on)- Throws:
StandardException
-
getQueryDescriptions
-
run
- Specified by:
run
in interfacePrivilegedAction<Properties>
-
newSList
-
getTablePermissions
public TablePermsDescriptor getTablePermissions(UUID tableUUID, String authorizationId) throws StandardException Get one user's privileges on a table- Specified by:
getTablePermissions
in interfaceDataDictionary
- Parameters:
tableUUID
-authorizationId
- The user name- Returns:
- a TablePermsDescriptor or null if the user has no permissions on the table.
- Throws:
StandardException
-
getTablePermissions
Description copied from interface:DataDictionary
Get one user's privileges on a table using tablePermsUUID- Specified by:
getTablePermissions
in interfaceDataDictionary
- Parameters:
tablePermsUUID
-- Returns:
- a TablePermsDescriptor
- Throws:
StandardException
-
getPermissions
- Throws:
StandardException
-
getColumnPermissions
Description copied from interface:DataDictionary
Get one user's column privileges on a table using colPermsUUID- Specified by:
getColumnPermissions
in interfaceDataDictionary
- Parameters:
colPermsUUID
-- Returns:
- a ColPermsDescriptor
- Throws:
StandardException
-
getColumnPermissions
public ColPermsDescriptor getColumnPermissions(UUID tableUUID, int privType, boolean forGrant, String authorizationId) throws StandardException Get one user's column privileges for a table.- Specified by:
getColumnPermissions
in 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, String privTypeStr, boolean forGrant, String authorizationId) throws StandardException Get one user's column privileges for a table. This routine gets called during revoke privilege processing- Specified by:
getColumnPermissions
in 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, String authorizationId) throws StandardException Get one user's permissions for a routine (function or procedure).- Specified by:
getRoutinePermissions
in interfaceDataDictionary
- Parameters:
routineUUID
-authorizationId
- The user's name- Returns:
- The descriptor of the users permissions for the routine.
- Throws:
StandardException
-
getRoutinePermissions
Description copied from interface:DataDictionary
Get one user's privileges for a routine using routinePermsUUID- Specified by:
getRoutinePermissions
in interfaceDataDictionary
- Parameters:
routinePermsUUID
-- Returns:
- a RoutinePermsDescriptor
- Throws:
StandardException
-
addRemovePermissionsDescriptor
public boolean addRemovePermissionsDescriptor(boolean add, PermissionsDescriptor perm, String grantee, TransactionController tc) throws StandardException Add or remove a permission to/from the permission database.- Specified by:
addRemovePermissionsDescriptor
in 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
-
getUncachedTablePermsDescriptor
TablePermsDescriptor getUncachedTablePermsDescriptor(TablePermsDescriptor key) throws StandardException Get a table permissions descriptor from the system tables, without going through the cache. This method is called to fill the permissions cache.- Returns:
- a TablePermsDescriptor that describes the table permissions granted to the grantee, null if no table-level permissions have been granted to him on the table.
- Throws:
StandardException
-
getUncachedColPermsDescriptor
Get a column permissions descriptor from the system tables, without going through the cache. This method is called to fill the permissions cache.- Returns:
- a ColPermsDescriptor that describes the column permissions granted to the grantee, null if no column permissions have been granted to him on the table.
- Throws:
StandardException
-
getUncachedPermissionsDescriptor
private <T extends PermissionsDescriptor> T getUncachedPermissionsDescriptor(int catalogNumber, int indexNumber, T key, Class<T> returnType) throws StandardException - Throws:
StandardException
-
getUncachedRoutinePermsDescriptor
RoutinePermsDescriptor getUncachedRoutinePermsDescriptor(RoutinePermsDescriptor key) throws StandardException Get a routine permissions descriptor from the system tables, without going through the cache. This method is called to fill the permissions cache.- Returns:
- a RoutinePermsDescriptor that describes the table permissions granted to the grantee, null if no table-level permissions have been granted to him on the table.
- Throws:
StandardException
-
getVTIClass
Description copied from interface:DataDictionary
Return the Java class to use for the VTI to which the received table descriptor maps. There are two kinds of VTI mappings that we do: the first is for "table names", the second is for "table function names". Table names can only be mapped to VTIs that do not accept any arguments; any VTI that has at least one constructor which accepts one or more arguments must be mapped from a table *function* name. An example of a VTI "table name" is the following: select * from SYSCS_DIAG.LOCK_TABLE In this case "SYSCS_DIAG.LOCK_TABLE" is the table name that we want to map. Since the corresonding VTI does not accept any arguments, this VTI table name can be used anywhere a normal base table name can be used. An example of a VTI "table function name" is the following: select * from TABLE(SYSCS_DIAG.SPACE_TABLE(?)) x In this case "SYSCS_DIAG.SPACE_TABLE" is the table function name that we want to map. Since the corresponding VTI can take either one or two arguments we have to use the TABLE constructor syntax to pass the argument(s) in as if we were making a function call. Hence the term "table function".- Specified by:
getVTIClass
in 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:
-
getBuiltinVTIClass
public String getBuiltinVTIClass(TableDescriptor td, boolean asTableFunction) throws StandardException Description copied from interface:DataDictionary
Return the Java class to use for a builtin VTI to which the received table descriptor maps.- Specified by:
getBuiltinVTIClass
in 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:
-
getRoleGrantDescriptor
Description copied from interface:DataDictionary
Get the role grant descriptor corresponding to the uuid provided- Specified by:
getRoleGrantDescriptor
in interfaceDataDictionary
- Parameters:
uuid
-- Returns:
- The descriptor for the role grant descriptor
- Throws:
StandardException
- Thrown on error- See Also:
-
getRoleDefinitionDescriptor
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:
getRoleDefinitionDescriptor
in 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:
-
getRoleGrantDescriptor
public RoleGrantDescriptor getRoleGrantDescriptor(String roleName, String grantee, 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:
getRoleGrantDescriptor
in 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:
-
existsGrantToAuthid
public boolean existsGrantToAuthid(String authId, TransactionController tc) throws StandardException Check all dictionary tables and return true if there is any GRANT descriptor containingauthId
as its grantee.- Specified by:
existsGrantToAuthid
in 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
-
dropJDBCMetadataSPSes
Remove metadata stored prepared statements.- Parameters:
tc
- the xact- Throws:
StandardException
-
updateMetadataSPSes
Drop and recreate metadata stored prepared statements.- Specified by:
updateMetadataSPSes
in interfaceDataDictionary
- Parameters:
tc
- the xact- Throws:
StandardException
-
dropSequenceDescriptor
public void dropSequenceDescriptor(SequenceDescriptor descriptor, TransactionController tc) throws StandardException Drops a sequence descriptor- Specified by:
dropSequenceDescriptor
in interfaceDataDictionary
- Parameters:
descriptor
- The descriptor to droptc
- The TransactionController.- Throws:
StandardException
- Thrown on failure
-
getSequenceDescriptor
Description copied from interface:DataDictionary
get a descriptor for a Sequence by uuid- Specified by:
getSequenceDescriptor
in interfaceDataDictionary
- Parameters:
uuid
- uuid of the sequence- Returns:
- the SequenceDescriptor
- Throws:
StandardException
- error
-
getSequenceDescriptor
public SequenceDescriptor getSequenceDescriptor(SchemaDescriptor sd, String sequenceName) throws StandardException Get the sequence descriptor given a sequence name and a schema Id.- Specified by:
getSequenceDescriptor
in interfaceDataDictionary
- Parameters:
sd
- The schema descriptor.sequenceName
- The sequence name, guaranteed to be unique only within its schema.- Returns:
- The SequenceDescriptor for the constraints.
- Throws:
StandardException
- Thrown on failure
-
putSequenceID
Map ( schemaName, sequenceName ) to sequenceID- Throws:
StandardException
-
dropSequenceID
Drop a sequenceID from the ( schemaName, sequenceName ) map- Throws:
StandardException
-
getSequenceID
Get the uuid string of a sequence given its schema and sequence name.
- Throws:
StandardException
-
getUncachedGenericPermDescriptor
Get an object's permission descriptor from the system tables, without going through the cache. This method is called to fill the permissions cache.- Returns:
- a PermDescriptor that describes the table permissions granted to the grantee on an objcet , null if no table-level permissions have been granted to him on the table.
- Throws:
StandardException
-
getGenericPermissions
public PermDescriptor getGenericPermissions(UUID objectUUID, String objectType, String privilege, String granteeAuthId) throws StandardException Get permissions granted to one user for an object using the object's Id and the user's authorization Id.- Specified by:
getGenericPermissions
in 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
Get one user's privileges for an object using the permUUID.- Specified by:
getGenericPermissions
in 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:
dropAllPermDescriptors
in 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
Returns the index statistics refresher.- Specified by:
getIndexStatsRefresher
in interfaceDataDictionary
- Parameters:
asDaemon
- whether the usage is automatic (true
) or explicit (false
)- Returns:
- The index statistics refresher instance, or
null
if disabled. IfasDaemon
isfalse
, an instance will always be returned.
-
disableIndexStatsRefresher
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:
disableIndexStatsRefresher
in 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:
doCreateIndexStatsRefresher
in interfaceDataDictionary
- Returns:
true
if an index statistics refresher should be created,false
if one already exists.
-
createIndexStatsRefresher
Creates an index statistics refresher for this data dictionary.The index statistics refresher is used to create and refresh index cardinality statistics, either automatically or on user demand (i.e. by invoking SYSCS_UTIL.SYSCS_UPDATE_STATISTICS).
- Specified by:
createIndexStatsRefresher
in interfaceDataDictionary
- Parameters:
db
- the database object associated with this data dictionarydbName
- the name of the database
-
getDependableFinder
Description copied from interface:DataDictionary
Get aDependableFinder
instance.- Specified by:
getDependableFinder
in interfaceDataDictionary
- Parameters:
formatId
- the format id- Returns:
- an instance capable of finding
Dependable
s with the specified format id
-
getColumnDependableFinder
Description copied from interface:DataDictionary
Get aDependableFinder
instance for referenced columns in a table.- Specified by:
getColumnDependableFinder
in interfaceDataDictionary
- Parameters:
formatId
- the format idcolumnBitMap
- byte array encoding the bitmap of referenced columns- Returns:
- an instance capable of finding
Dependable
s with the specified format id
-
createIdentitySequences
Create sequence generators for all identity columns on upgrade to 10.11.- Throws:
StandardException
-
createIdentitySequence
private void createIdentitySequence(TableDescriptor td, ColumnDescriptor cd, TransactionController tc) throws StandardException Create a sequence generator for an identity column on upgrade to 10.11.- Throws:
StandardException
-
getContextService
Privileged lookup of the ContextService. Must be private so that user code can't call this entry point. -
getContextOrNull
Privileged lookup of a Context. Must be private so that user code can't call this entry point. -
getContext
Privileged lookup of a Context. Must be private so that user code can't call this entry point. -
getMonitor
Privileged Monitor lookup. Must be package private so that user code can't call this entry point. -
startSystemModule
Privileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
bootServiceModule
private static Object bootServiceModule(boolean create, Object serviceModule, String factoryInterface, Properties properties) throws StandardException Privileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
findServiceModule
private static Object findServiceModule(Object serviceModule, String factoryInterface) throws StandardException Privileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-