Interface LanguageConnectionContext
-
- All Superinterfaces:
Context
- All Known Implementing Classes:
GenericLanguageConnectionContext
public interface LanguageConnectionContext extends Context
LanguageConnectionContext keeps the result sets, and activations in use by the current connection.More stable items, like other factories, are accessible through the LanguageConnectionFactory or the LanguageFactory.
- See Also:
LanguageConnectionFactory
,LanguageFactory
-
-
Field Summary
Fields Modifier and Type Field Description static int
ANSI_CASING
static int
ANTI_ANSI_CASING
static java.lang.String
CONTEXT_ID
this is the ID we expect these contexts to be stored into a context manager under.static java.lang.String
dbnameStr
static java.lang.String
drdaStr
static java.lang.String
lccStr
static int
MULTI_TRANSACTION_LOCK
static int
NO_SCHEMAS
static int
OUTERMOST_STATEMENT
static int
SINGLE_TRANSACTION_LOCK
static int
SQL92_SCHEMAS
static int
UNKNOWN_CASING
static int
USER_NAME_SCHEMA
static java.lang.String
xidStr
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addActivation(Activation a)
Add the activation to those known about by this connection.void
addDeclaredGlobalTempTable(TableDescriptor td)
Add the declared global temporary table to the list of temporary tables known by this connection.void
autoincrementCreateCounter(java.lang.String s, java.lang.String t, java.lang.String c, java.lang.Long initialValue, long increment, int position)
Create an autoincrement counter to be used on behalf of a SQL-J statement.void
autoincrementFlushCache(UUID tableUUID)
Flush the cache of autoincrement values being kept by the lcc.void
beginNestedTransaction(boolean readOnly)
Begin a nested transaction.boolean
checkIfAnyDeclaredGlobalTempTablesForThisConnection()
Check if there are any global temporary tables declared for this connection.void
checkIntegrity()
Check that deferred constraints are valid, if not roll back the transaction.void
closeUnusedActivations()
Close any unused activations in this connection context.void
commitNestedTransaction()
commit a nested transaction.void
copyHashtableToAIHT(java.util.Map<java.lang.String,java.lang.Long> from)
Copy a map of autoincrement key value pairs into the cache of ai values stored in the language connection context.SQLSessionContext
createSQLSessionContext()
Create a fresh SQLSessionContext for this connection.boolean
dataDictionaryInWriteMode()
Return true if the data dictionary is in write mode (that is, this context was informed that is is in write mode by the method call setDataDictionaryWriteMode().int
decrementBindCount()
Decrement the DataDictionary bind count.boolean
dropDeclaredGlobalTempTable(java.lang.String tableName)
Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.int
getActivationCount()
Return the number of activation known for this connection.ASTVisitor
getASTVisitor()
Get the Visitor which should walk the AST.Authorizer
getAuthorizer()
Get an Authorizer for this connection.boolean
getAutoincrementUpdate()
Returns the current value of autoincrementUpdate.int
getBindCount()
Get the DataDictionary bind count.int
getCurrentIsolationLevel()
Get the current isolation level.java.lang.String
getCurrentIsolationLevelStr()
Get the current isolation level in DB2 format.java.lang.String
getCurrentRoleId(Activation a)
Get the current role authorization identifier of the dynamic call context associated with this activation.java.lang.String
getCurrentRoleIdDelimited(Activation a)
Get the current role authorization identifier in external delimited form (not case normal form) of the dynamic call context associated with this activation.java.lang.String
getCurrentSchemaName()
Get the current schema name (at compile-time, see explanations for getDefaultSchema overloads).java.lang.String
getCurrentSchemaName(Activation a)
Get the current schema name (at execution time, see explanations for getDefaultSchema overloads); This version is used by CURRENT SCHEMA.SQLSessionContext
getCurrentSQLSessionContext(Activation activation)
Get the SQL session context of the given activation.java.lang.String
getCurrentUserId(Activation a)
Get the Authorization Id of the current userDatabase
getDatabase()
Returns the Database of this connection.DataDictionary
getDataDictionary()
Get the data dictionaryDataValueFactory
getDataValueFactory()
Get the data value factory to use with this language connection context.java.lang.String
getDbname()
Get the database name of this LCC.SchemaDescriptor
getDefaultSchema()
Get the default schema (used at compile-time when no activation is yet available, cf. the activation argument overload version.SchemaDescriptor
getDefaultSchema(Activation a)
Get the default schema (used at execution time).java.util.HashMap<UUID,DeferredConstraintsMemory.ValidationInfo>
getDeferredHashTables()
Get the set of disk backed hash tables containing any index rows saved for deferred unique/PK constraints in this transaction, keyed by the conglomerate id, or rows saved containing row locations violating rows for deferred check constraints.java.lang.String
getDrdaID()
Get the DRDA ID of this LCC.java.lang.Long
getIdentityValue()
Get the identity column value most recently generated.int
getInstanceNumber()
Get the instance number of this LCC.StandardException
getInterruptedException()
Get exception created when we detected interruped status flag.LanguageConnectionFactory
getLanguageConnectionFactory()
Get the language connection factory to use with this language connection context.LanguageFactory
getLanguageFactory()
Get the language factory to use with this language connection context.Activation
getLastActivation()
Return the last activation added This is used to find the drop activation in dropViewCascade so we can add warning messages to the activationjava.lang.Object
getLastQueryTree()
Debug method for retrieving the last query tree.int
getLockEscalationThreshold()
get the lock escalation threshold to use with this connection.boolean
getLogQueryPlan()
Get value of logQueryPlan.boolean
getLogStatementText()
Get value of logStatementText.OptimizerFactory
getOptimizerFactory()
get the optimizer factory to use with this language connection context.OptTrace
getOptimizerTracer()
Get the optimizer tracer (could be null if we aren't tracing the optimizer).int
getPrepareIsolationLevel()
Get the prepare isolation level.java.util.Map<java.lang.Object,java.lang.Object>
getPrintedObjectsMap()
Return a map of AST nodes that have already been printed during a compiler phase, so as to be able to avoid printing a node more than once.FormatableBitSet
getReferencedColumnMap(TableDescriptor td)
Get the referenced column map for a tableboolean
getRunTimeStatisticsMode()
Get the RUNTIMESTATISTICS mode.RunTimeStatistics
getRunTimeStatisticsObject()
Get the RUNTIMESTATISTICS object.java.lang.String
getSessionUserId()
Get the Authorization Id of the session userStatementContext
getStatementContext()
Get the current StatementContext.int
getStatementDepth()
Reports how many statement levels deep we are.boolean
getStatisticsTiming()
Get the STATISTICS TIMING mode.TableDescriptor
getTableDescriptorForDeclaredGlobalTempTable(java.lang.String tableName)
Get table descriptor for the declared global temporary table from the list of temporary tables known by this connection.SQLSessionContext
getTopLevelSQLSessionContext()
Get the value of top level session context of the top level connection.TransactionController
getTransactionCompile()
Get the transaction controller to use with this language connection context at compile time.TransactionController
getTransactionExecute()
Get the transaction controller to use with this language connection context during execute time.TriggerExecutionContext
getTriggerExecutionContext()
Get the topmost tec.TableDescriptor
getTriggerTable()
Get the topmost trigger table descriptorjava.lang.String
getUniqueCursorName()
Get a connection unique system generated name for a cursor.int
getUniqueSavepointID()
Get a connection unique system generated id for an unnamed savepoint.java.lang.String
getUniqueSavepointName()
Get a connection unique system generated name for an unnamed savepoint.boolean
getXplainOnlyMode()
gets the current set XplainOnlyModejava.lang.String
getXplainSchema()
gets the current set XplainSchemajava.lang.Object
getXplainStatement(java.lang.Object key)
int
incrementBindCount()
Increment the DataDictionary bind count.void
initialize()
Initialize.void
internalCommit(boolean commitStore)
Do a commit, as internally needed by Derby.void
internalCommitNoSync(int commitflag)
Similar to internalCommit() but has logic for an unsynchronized commitvoid
internalRollback()
Do a rollback, as internally needed by Derby.void
internalRollbackToSavepoint(java.lang.String savepointName, boolean refreshStyle, java.lang.Object kindOfSavepoint)
Let the context deal with a rollback to savepointboolean
isEffectivelyDeferred(SQLSessionContext sc, UUID constraintId)
Determines if a check or foreign key constraint has deferred mode.boolean
isInitialDefaultSchema(java.lang.String schemaName)
Return true if this schema name is the initial default schema for the current session.boolean
isIsolationLevelSetUsingSQLorJDBC()
Returns true if isolation level has been set using JDBC/SQL.boolean
isReadOnly()
Get the readOnly status for the current connection.boolean
isTransactionPristine()
Reports whether there is any outstanding work in the transaction.void
languageSetSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint)
Sets a savepoint.java.lang.Long
lastAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
Returns the last autoincrement value inserted by this connection.CursorActivation
lookupCursorActivation(java.lang.String cursorName)
See if a given cursor is available for use.void
markTempTableAsModifiedInUnitOfWork(java.lang.String tableName)
Mark the passed temporary table as modified in the current unit of work.long
nextAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
returns the next value to be inserted into an autoincrement col.void
notifyUnusedActivation()
Make a note that some activations are marked unusedboolean
optimizerTracingIsOn()
Get whether or not optimizer trace is on.void
popCompilerContext(CompilerContext compilerContext)
Pop a CompilerContext off the context stack.void
popExecutionStmtValidator(ExecutionStmtValidator validator)
Remove the validator.void
popNestedSessionContext(Activation a)
If returning from a routine that can execute SQL, perform any actions needed when popping the SQL session context.void
popStatementContext(StatementContext statementContext, java.lang.Throwable error)
Pop a StatementContext of the context stack.void
popTriggerExecutionContext(TriggerExecutionContext tec)
Remove the tec.void
popTriggerTable(TableDescriptor td)
Remove the trigger table descriptor.PreparedStatement
prepareInternalStatement(java.lang.String sqlText)
Return a PreparedStatement object for the query.PreparedStatement
prepareInternalStatement(SchemaDescriptor compilationSchema, java.lang.String sqlText, boolean isForReadOnly, boolean allowInternalSyntax)
Return a PreparedStatement object for the query.CompilerContext
pushCompilerContext()
Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against.CompilerContext
pushCompilerContext(SchemaDescriptor sd)
Push a CompilerContext on the context stack with the passed in default schema as the default schema we compile against.void
pushExecutionStmtValidator(ExecutionStmtValidator validator)
Push a new execution statement validator.void
pushNestedSessionContext(Activation a, boolean definersRights, java.lang.String definer)
Create a new SQL session context for the current activation on the basis of the existing SQL session context.StatementContext
pushStatementContext(boolean isAtomic, boolean isForReadOnly, java.lang.String stmtText, ParameterValueSet pvs, boolean rollbackParentContext, long timeoutMillis)
Push a StatementContext on the context stack.void
pushTriggerExecutionContext(TriggerExecutionContext tec)
Push a new trigger execution context.void
pushTriggerTable(TableDescriptor td)
Set the trigger table descriptor.void
releaseSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint)
Let the context deal with a release of a savepointvoid
removeActivation(Activation a)
Remove the activation from those known about by this connection.void
resetFromPool()
Reset the connection before it is returned (indirectly) by a PooledConnection object.void
resetIsolationLevelFlagUsedForSQLandJDBC()
Reset the isolation level flag used to keep correct isolation level state in BrokeredConnection.void
resetSchemaUsages(Activation activation, java.lang.String schemaName)
Reset any occurence of schemaName as current default schema in the SQLSessionContext stack to the initial default, because schemaName is no longer a valid schema.boolean
roleIsSettable(Activation a, java.lang.String role)
Checks whether the given role can be legally set for the current user.void
setASTVisitor(ASTVisitor visitor)
Set a Visitor which walks the AST at various stages.void
setAutoincrementUpdate(boolean flag)
Sets autoincrementUpdate-- this variable allows updates to autoincrement columns if it is set to true.void
setConstraintDeferred(Activation a, ConstraintDescriptor cd, boolean deferred)
Set the constraint mode for this constraint todeferred
.void
setCurrentRole(Activation a, java.lang.String role)
Set the current rolevoid
setDataDictionaryWriteMode()
Remember that the DataDictionary is in write mode, so we can take it out of write mode at the end of the transaction.void
setDefaultSchema(Activation a, SchemaDescriptor sd)
Set the default schema (at execution time, see explanations for getDefaultSchema overloads); This version is used by SET SCHEMA.void
setDefaultSchema(SchemaDescriptor sd)
Set the default schema (at compile-time, see explanations for getDefaultSchema overloads).void
setDeferredAll(Activation a, boolean deferred)
Set the constraint mode of all deferrable constraints to the value ofdeferred
.void
setDrdaID(java.lang.String drdaID)
Set the DRDA ID of this LCC.void
setIdentityValue(long val)
Set the field of most recently generated identity column value.void
setInterruptedException(StandardException e)
Set the exception created and associated with the detected interruped status flag.void
setIsolationLevel(int isolationLevel)
Set current isolation level.void
setLastQueryTree(java.lang.Object queryTree)
Debug method for remembering the last query tree.void
setLogStatementText(boolean logStatementText)
Set value of logStatementText (Whether or not to write info on currently executing statement to error log.)void
setOptimizerTracer(OptTrace tracer)
Install an optimizer tracer (to enable tracing) or uninstall the current optimizer tracer (to disable tracing).void
setPrepareIsolationLevel(int isolationLevel)
void
setReadOnly(boolean onOrOff)
Set the readOnly status for the current connection.void
setReferencedColumnMap(TableDescriptor td, FormatableBitSet map)
Set the referenced column map for a tablevoid
setRunTimeStatisticsMode(boolean onOrOff)
Turn RUNTIMESTATISTICS on or off.void
setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
Set the RUNTIMESTATISTICS object.void
setStatisticsTiming(boolean onOrOff)
Turn STATISTICS TIMING on or off.void
setupSubStatementSessionContext(Activation a)
Used when a statement as part of its operation executes an other statement.void
setXplainOnlyMode(boolean onOrOff)
sets the XplainOnlyMode.void
setXplainSchema(java.lang.String schema)
sets the XplainSchemavoid
setXplainStatement(java.lang.Object key, java.lang.Object stmt)
void
userCommit()
Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement.void
userRollback()
Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement.boolean
usesSqlAuthorization()
Check if in SQL standard mode, with support for Grant and Revokevoid
validateStmtExecution(ConstantAction constantAction)
Validate a statement.boolean
verifyAllHeldResultSetsAreClosed()
Verify that there are no activations with open held result sets.boolean
verifyNoOpenResultSets(PreparedStatement pStmt, Provider provider, int action)
Verify that there are no activations with open result sets on the specified prepared statement.void
xaCommit(boolean onePhase)
Commit a distrubuted transaction.void
xaRollback()
Roll back a distrubuted transaction.-
Methods inherited from interface org.apache.derby.iapi.services.context.Context
cleanupOnError, getContextManager, getIdName, isLastHandler, popMe, pushMe
-
-
-
-
Field Detail
-
CONTEXT_ID
static final java.lang.String CONTEXT_ID
this is the ID we expect these contexts to be stored into a context manager under.- See Also:
- Constant Field Values
-
OUTERMOST_STATEMENT
static final int OUTERMOST_STATEMENT
- See Also:
- Constant Field Values
-
SQL92_SCHEMAS
static final int SQL92_SCHEMAS
- See Also:
- Constant Field Values
-
USER_NAME_SCHEMA
static final int USER_NAME_SCHEMA
- See Also:
- Constant Field Values
-
NO_SCHEMAS
static final int NO_SCHEMAS
- See Also:
- Constant Field Values
-
xidStr
static final java.lang.String xidStr
- See Also:
- Constant Field Values
-
lccStr
static final java.lang.String lccStr
- See Also:
- Constant Field Values
-
dbnameStr
static final java.lang.String dbnameStr
- See Also:
- Constant Field Values
-
drdaStr
static final java.lang.String drdaStr
- See Also:
- Constant Field Values
-
SINGLE_TRANSACTION_LOCK
static final int SINGLE_TRANSACTION_LOCK
- See Also:
- Constant Field Values
-
MULTI_TRANSACTION_LOCK
static final int MULTI_TRANSACTION_LOCK
- See Also:
- Constant Field Values
-
UNKNOWN_CASING
static final int UNKNOWN_CASING
- See Also:
- Constant Field Values
-
ANSI_CASING
static final int ANSI_CASING
- See Also:
- Constant Field Values
-
ANTI_ANSI_CASING
static final int ANTI_ANSI_CASING
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
void initialize() throws StandardException
Initialize. For use after pushing the contexts that initialization needs.- Throws:
StandardException
- thrown if something goes wrong
-
getLogStatementText
boolean getLogStatementText()
Get value of logStatementText. (Whether or not to write info on currently executing statement to error log.)- Returns:
- value of logStatementText
-
setLogStatementText
void setLogStatementText(boolean logStatementText)
Set value of logStatementText (Whether or not to write info on currently executing statement to error log.)- Parameters:
logStatementText
- Whether or not logStatementText property is set.
-
getLogQueryPlan
boolean getLogQueryPlan()
Get value of logQueryPlan. (Whether or not to write query plan info on currently executing statement to error log.)- Returns:
- value of logQueryPlan
-
getLockEscalationThreshold
int getLockEscalationThreshold()
get the lock escalation threshold to use with this connection.
-
addActivation
void addActivation(Activation a) throws StandardException
Add the activation to those known about by this connection.- Throws:
StandardException
-
notifyUnusedActivation
void notifyUnusedActivation()
Make a note that some activations are marked unused
-
removeActivation
void removeActivation(Activation a) throws StandardException
Remove the activation from those known about by this connection.- Throws:
StandardException
- thrown if something goes wrong
-
getActivationCount
int getActivationCount()
Return the number of activation known for this connection.
-
lookupCursorActivation
CursorActivation lookupCursorActivation(java.lang.String cursorName)
See if a given cursor is available for use. This is used to locate the cursor during its execution.- Returns:
- the activation for the given cursor, null if none exists.
-
getLastActivation
Activation getLastActivation()
Return the last activation added This is used to find the drop activation in dropViewCascade so we can add warning messages to the activation
-
getUniqueCursorName
java.lang.String getUniqueCursorName()
Get a connection unique system generated name for a cursor.
-
getUniqueSavepointName
java.lang.String getUniqueSavepointName()
Get a connection unique system generated name for an unnamed savepoint.
-
getUniqueSavepointID
int getUniqueSavepointID()
Get a connection unique system generated id for an unnamed savepoint.
-
checkIfAnyDeclaredGlobalTempTablesForThisConnection
boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
Check if there are any global temporary tables declared for this connection.- Returns:
- true if there are declared temp tables for this connectoin else false
-
markTempTableAsModifiedInUnitOfWork
void markTempTableAsModifiedInUnitOfWork(java.lang.String tableName)
Mark the passed temporary table as modified in the current unit of work. That information will be used at rollback time The compile phase will generate code to call this method if the DML is on a temporary table- Parameters:
tableName
- Mark the passed temporary table name as modified
-
addDeclaredGlobalTempTable
void addDeclaredGlobalTempTable(TableDescriptor td) throws StandardException
Add the declared global temporary table to the list of temporary tables known by this connection.- Parameters:
td
- Corresponding to the temporary table- Throws:
StandardException
-
dropDeclaredGlobalTempTable
boolean dropDeclaredGlobalTempTable(java.lang.String tableName)
Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.- Parameters:
tableName
- look for this table name in the saved list and drop it if found- Returns:
- true if dropped the temporary table. False if no such temporary table exists.
- See Also:
TempTableInfo
-
getTableDescriptorForDeclaredGlobalTempTable
TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(java.lang.String tableName)
Get table descriptor for the declared global temporary table from the list of temporary tables known by this connection.- Parameters:
tableName
- Get table descriptor for the passed table name- Returns:
- TableDescriptor if found the temporary table. Else return null
-
resetFromPool
void resetFromPool() throws StandardException
Reset the connection before it is returned (indirectly) by a PooledConnection object. See EmbeddedConnection.- Throws:
StandardException
-
internalCommit
void internalCommit(boolean commitStore) throws StandardException
Do a commit, as internally needed by Derby. E.g. a commit for sync, or a commit for autocommit. Skips checks that a user isn't doing something bad like issuing a commit in a nested xact.- Parameters:
commitStore
- true if we should commit the Store transaction- Throws:
StandardException
- thrown if something goes wrong
-
internalCommitNoSync
void internalCommitNoSync(int commitflag) throws StandardException
Similar to internalCommit() but has logic for an unsynchronized commit- Parameters:
commitflag
- the flags to pass to commitNoSync in the store's TransactionController- Throws:
StandardException
- thrown if something goes wrong
-
userCommit
void userCommit() throws StandardException
Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement.- Throws:
StandardException
- thrown if something goes wrong
-
xaCommit
void xaCommit(boolean onePhase) throws StandardException
Commit a distrubuted transaction.- Parameters:
onePhase
- if true, allow it to commit without first going thru a prepared state.- Throws:
StandardException
- thrown if something goes wrong
-
internalRollback
void internalRollback() throws StandardException
Do a rollback, as internally needed by Derby. E.g. a rollback for sync, or a rollback for an internal error. Skips checks that a user isn't doing something bad like issuing a rollback in a nested xact.- Throws:
StandardException
- thrown if something goes wrong
-
userRollback
void userRollback() throws StandardException
Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement.- Throws:
StandardException
- thrown if something goes wrong
-
internalRollbackToSavepoint
void internalRollbackToSavepoint(java.lang.String savepointName, boolean refreshStyle, java.lang.Object kindOfSavepoint) throws StandardException
Let the context deal with a rollback to savepoint- Parameters:
savepointName
- Name of the savepoint that needs to be rolled backrefreshStyle
- boolean indicating whether or not the controller should close open conglomerates and scans. Also used to determine if language should close open activations.kindOfSavepoint
- A NULL value means it is an internal savepoint (ie not a user defined savepoint) Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint A String value for kindOfSavepoint would mean it is SQL savepoint A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint- Throws:
StandardException
- thrown if something goes wrong
-
releaseSavePoint
void releaseSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint) throws StandardException
Let the context deal with a release of a savepoint- Parameters:
savepointName
- Name of the savepoint that needs to be releasedkindOfSavepoint
- A NULL value means it is an internal savepoint (ie not a user defined savepoint) Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint A String value for kindOfSavepoint would mean it is SQL savepoint A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint- Throws:
StandardException
- thrown if something goes wrong
-
xaRollback
void xaRollback() throws StandardException
Roll back a distrubuted transaction.- Throws:
StandardException
- thrown if something goes wrong
-
languageSetSavePoint
void languageSetSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint) throws StandardException
Sets a savepoint. Causes the Store to set a savepoint.- Parameters:
savepointName
- name of savepointkindOfSavepoint
- A NULL value means it is an internal savepoint (ie not a user defined savepoint) Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint A String value for kindOfSavepoint would mean it is SQL savepoint A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint- Throws:
StandardException
- thrown if something goes wrong
-
beginNestedTransaction
void beginNestedTransaction(boolean readOnly) throws StandardException
Begin a nested transaction.- Parameters:
readOnly
- The nested transaction would be read only if param value true- Throws:
StandardException
- on error.- See Also:
TransactionController.startNestedUserTransaction(boolean, boolean)
-
commitNestedTransaction
void commitNestedTransaction() throws StandardException
commit a nested transaction. We do not provide a abortNestedTransaction. If a nested xaction is aborted, then this results in the parent xaction also being aborted. This is not what we need for releasing compile time locks or autoincrement-- hence we do not provide abortNestedTransaction.- Throws:
StandardException
- thrown on erro- See Also:
TransactionController.startNestedUserTransaction(boolean, boolean)
-
getTransactionCompile
TransactionController getTransactionCompile()
Get the transaction controller to use with this language connection context at compile time.
-
getTransactionExecute
TransactionController getTransactionExecute()
Get the transaction controller to use with this language connection context during execute time.
-
getDataDictionary
DataDictionary getDataDictionary()
Get the data dictionary- Returns:
- the data dictionary
-
getDataValueFactory
DataValueFactory getDataValueFactory()
Get the data value factory to use with this language connection context.
-
getLanguageFactory
LanguageFactory getLanguageFactory()
Get the language factory to use with this language connection context.
-
getOptimizerFactory
OptimizerFactory getOptimizerFactory()
get the optimizer factory to use with this language connection context.
-
getLanguageConnectionFactory
LanguageConnectionFactory getLanguageConnectionFactory()
Get the language connection factory to use with this language connection context.
-
getCurrentUserId
java.lang.String getCurrentUserId(Activation a)
Get the Authorization Id of the current user- Parameters:
a
- activation- Returns:
- String the authorization id
-
getSessionUserId
java.lang.String getSessionUserId()
Get the Authorization Id of the session user- Returns:
- String the authorization id
-
getDefaultSchema
SchemaDescriptor getDefaultSchema()
Get the default schema (used at compile-time when no activation is yet available, cf. the activation argument overload version.- Returns:
- SchemaDescriptor the default schema
-
getDefaultSchema
SchemaDescriptor getDefaultSchema(Activation a)
Get the default schema (used at execution time). At execution time, the current statement context is not always a reliable place to find the correct SQL session context, viz. when a dynamic result set referencing CURRENT SCHEMA is accessed after a called procedure has returned only the activation of the call is live and still holds the correct session context.- Parameters:
a
- current activation- Returns:
- SchemaDescriptor the default schema
-
setDefaultSchema
void setDefaultSchema(SchemaDescriptor sd) throws StandardException
Set the default schema (at compile-time, see explanations for getDefaultSchema overloads).- Parameters:
sd
- the new default schema. If null, then the default schema descriptor is used.- Throws:
StandardException
- thrown on failure
-
setDefaultSchema
void setDefaultSchema(Activation a, SchemaDescriptor sd) throws StandardException
Set the default schema (at execution time, see explanations for getDefaultSchema overloads); This version is used by SET SCHEMA.- Parameters:
a
- current activationsd
- the new default schema. If null, then the default schema descriptor is used.- Throws:
StandardException
- thrown on failure
-
resetSchemaUsages
void resetSchemaUsages(Activation activation, java.lang.String schemaName) throws StandardException
Reset any occurence of schemaName as current default schema in the SQLSessionContext stack to the initial default, because schemaName is no longer a valid schema.- Parameters:
activation
- current activationschemaName
- the schema name occurences of which is to be reset- Throws:
StandardException
-
getCurrentSchemaName
java.lang.String getCurrentSchemaName()
Get the current schema name (at compile-time, see explanations for getDefaultSchema overloads).- Returns:
- SchemaDescriptor the current schema
-
getCurrentSchemaName
java.lang.String getCurrentSchemaName(Activation a)
Get the current schema name (at execution time, see explanations for getDefaultSchema overloads); This version is used by CURRENT SCHEMA.- Returns:
- SchemaDescriptor the current schema
-
isInitialDefaultSchema
boolean isInitialDefaultSchema(java.lang.String schemaName)
Return true if this schema name is the initial default schema for the current session.- Parameters:
schemaName
-- Returns:
- true
-
getIdentityValue
java.lang.Long getIdentityValue()
Get the identity column value most recently generated.- Returns:
- the generated identity column value
-
setIdentityValue
void setIdentityValue(long val)
Set the field of most recently generated identity column value.- Parameters:
val
- the generated identity column value
-
verifyNoOpenResultSets
boolean verifyNoOpenResultSets(PreparedStatement pStmt, Provider provider, int action) throws StandardException
Verify that there are no activations with open result sets on the specified prepared statement.- Parameters:
pStmt
- The prepared Statementprovider
- The object precipitating a possible invalidationaction
- The action causing the possible invalidation- Returns:
- Nothing.
- Throws:
StandardException
- thrown on failure
-
verifyAllHeldResultSetsAreClosed
boolean verifyAllHeldResultSetsAreClosed() throws StandardException
Verify that there are no activations with open held result sets.- Returns:
- boolean Found no open resultsets.
- Throws:
StandardException
- thrown on failure
-
pushCompilerContext
CompilerContext pushCompilerContext()
Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against.- Returns:
- the compiler context
-
pushCompilerContext
CompilerContext pushCompilerContext(SchemaDescriptor sd)
Push a CompilerContext on the context stack with the passed in default schema as the default schema we compile against.- Parameters:
sd
- the default schema- Returns:
- the compiler context
-
popCompilerContext
void popCompilerContext(CompilerContext compilerContext)
Pop a CompilerContext off the context stack.- Parameters:
compilerContext
- The compiler context.
-
pushStatementContext
StatementContext pushStatementContext(boolean isAtomic, boolean isForReadOnly, java.lang.String stmtText, ParameterValueSet pvs, boolean rollbackParentContext, long timeoutMillis)
Push a StatementContext on the context stack.- Parameters:
isAtomic
- whether a commit/rollback is permitted from a nested connection under this statementstmtText
- the text of the statement. Needed for any language statement (currently, for any statement that can cause a trigger to fire). Please set this unless you are some funky jdbc setXXX method or something.pvs
- parameter value set, if it has onerollbackParentContext
- True if 1) the statement context is NOT a top-level context, AND 2) in the event of a statement-level exception, the parent context needs to be rolled back, too.timeoutMillis
- Timeout value for this statement, in milliseconds. Zero means no timeout.- Returns:
- StatementContext The statement context.
-
popStatementContext
void popStatementContext(StatementContext statementContext, java.lang.Throwable error)
Pop a StatementContext of the context stack.- Parameters:
statementContext
- The statement context.error
- The error, if any (Only relevant for DEBUG)
-
pushExecutionStmtValidator
void pushExecutionStmtValidator(ExecutionStmtValidator validator)
Push a new execution statement validator. An execution statement validator is an object that validates the current statement to ensure that it is permitted given the current execution context. An example of a validator a trigger ExecutionStmtValidator that doesn't allow ddl on the trigger target table.Multiple ExecutionStmtValidators may be active at any given time. This mirrors the way there can be multiple connection nestings at a single time. The validation is performed by calling each validator's validateStatement() method. This yields the union of all validations.
- Parameters:
validator
- the validator to add
-
popExecutionStmtValidator
void popExecutionStmtValidator(ExecutionStmtValidator validator) throws StandardException
Remove the validator. Does an object identity (validator == validator) comparison. Asserts that the validator is found.- Parameters:
validator
- the validator to remove- Throws:
StandardException
- on error
-
validateStmtExecution
void validateStmtExecution(ConstantAction constantAction) throws StandardException
Validate a statement. Does so by stepping through all the validators and executing them. If a validator throws and exception, then the checking is stopped and the exception is passed up.- Parameters:
constantAction
- the constantAction that is about to be executed (and should be validated- Throws:
StandardException
- on validation failure
-
pushTriggerExecutionContext
void pushTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
Push a new trigger execution context.Multiple TriggerExecutionContexts may be active at any given time.
- Parameters:
tec
- the trigger execution context- Throws:
StandardException
- on trigger recursion error
-
popTriggerExecutionContext
void popTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
Remove the tec. Does an object identity (tec == tec) comparison. Asserts that the tec is found.- Parameters:
tec
- the tec to remove- Throws:
StandardException
- on error
-
getTriggerExecutionContext
TriggerExecutionContext getTriggerExecutionContext()
Get the topmost tec.- Returns:
- the tec
-
pushTriggerTable
void pushTriggerTable(TableDescriptor td)
Set the trigger table descriptor. Used to compile statements that may special trigger pseudo tables.- Parameters:
td
- the table that the trigger is defined upon
-
popTriggerTable
void popTriggerTable(TableDescriptor td)
Remove the trigger table descriptor.- Parameters:
td
- the table to remove from the stack.
-
getTriggerTable
TableDescriptor getTriggerTable()
Get the topmost trigger table descriptor- Returns:
- the table descriptor, or null if we aren't in the middle of compiling a create trigger.
-
incrementBindCount
int incrementBindCount()
Increment the DataDictionary bind count. This is for keeping track of nested binding, which can happen if SQL statements are bound from within static initializers.- Returns:
- The new bind count
-
decrementBindCount
int decrementBindCount()
Decrement the DataDictionary bind count.- Returns:
- The new bind count
-
getBindCount
int getBindCount()
Get the DataDictionary bind count.- Returns:
- The current bind count.
-
setDataDictionaryWriteMode
void setDataDictionaryWriteMode()
Remember that the DataDictionary is in write mode, so we can take it out of write mode at the end of the transaction.
-
dataDictionaryInWriteMode
boolean dataDictionaryInWriteMode()
Return true if the data dictionary is in write mode (that is, this context was informed that is is in write mode by the method call setDataDictionaryWriteMode().
-
setRunTimeStatisticsMode
void setRunTimeStatisticsMode(boolean onOrOff)
Turn RUNTIMESTATISTICS on or off.
-
getRunTimeStatisticsMode
boolean getRunTimeStatisticsMode()
Get the RUNTIMESTATISTICS mode.
-
setStatisticsTiming
void setStatisticsTiming(boolean onOrOff)
Turn STATISTICS TIMING on or off.
-
getStatisticsTiming
boolean getStatisticsTiming()
Get the STATISTICS TIMING mode.
-
setRunTimeStatisticsObject
void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
Set the RUNTIMESTATISTICS object.
-
getRunTimeStatisticsObject
RunTimeStatistics getRunTimeStatisticsObject()
Get the RUNTIMESTATISTICS object.
-
getStatementDepth
int getStatementDepth()
Reports how many statement levels deep we are.- Returns:
- a statement level >= OUTERMOST_STATEMENT
-
getDatabase
Database getDatabase()
Returns the Database of this connection.
-
isIsolationLevelSetUsingSQLorJDBC
boolean isIsolationLevelSetUsingSQLorJDBC()
Returns true if isolation level has been set using JDBC/SQL.
-
resetIsolationLevelFlagUsedForSQLandJDBC
void resetIsolationLevelFlagUsedForSQLandJDBC()
Reset the isolation level flag used to keep correct isolation level state in BrokeredConnection. This resetting will happen at the start and end of a global transaction, after the BrokeredConection's isolation level state is brought upto date with the EmbedConnection's isolation state. The flag gets set to true when isolation level is set using JDBC/SQL.
-
setIsolationLevel
void setIsolationLevel(int isolationLevel) throws StandardException
Set current isolation level.- Parameters:
isolationLevel
- The new isolationLevel.- Throws:
StandardException
-
getCurrentIsolationLevel
int getCurrentIsolationLevel()
Get the current isolation level.- Returns:
- The current isolation level.
-
getCurrentIsolationLevelStr
java.lang.String getCurrentIsolationLevelStr()
Get the current isolation level in DB2 format.- Returns:
- The current isolation level as a 2 character string.
-
setPrepareIsolationLevel
void setPrepareIsolationLevel(int isolationLevel)
-
getPrepareIsolationLevel
int getPrepareIsolationLevel()
Get the prepare isolation level. If the isolation level has been explicitly set with a SQL statement or embedded call to setTransactionIsolation, this will return TransactionControl.UNSPECIFIED_ISOLATION_LEVEL SET ISOLATION always takes priority.
-
setReadOnly
void setReadOnly(boolean onOrOff) throws StandardException
Set the readOnly status for the current connection. This can only be called when the current transaction has not done any work.- Parameters:
onOrOff
- true sets the connection to be readOnly and false sets it to readWrite.- Throws:
StandardException
- The call failed and the readOnly status has not changed.
-
isReadOnly
boolean isReadOnly()
Get the readOnly status for the current connection.
-
getAuthorizer
Authorizer getAuthorizer()
Get an Authorizer for this connection.
-
getStatementContext
StatementContext getStatementContext()
Get the current StatementContext.
-
prepareInternalStatement
PreparedStatement prepareInternalStatement(SchemaDescriptor compilationSchema, java.lang.String sqlText, boolean isForReadOnly, boolean allowInternalSyntax) throws StandardException
Return a PreparedStatement object for the query. This method first tries to locate the PreparedStatement object from a statement cache. If the statement is not found in the cache, the query will be compiled and put into the cache.- Parameters:
compilationSchema
- schemasqlText
- sql query stringisForReadOnly
- read only status for resultset. Set to true if the concurrency mode for the resultset is CONCUR_READ_ONLYallowInternalSyntax
- If true, then this query is allowed to use internal sql syntax. One instance where this will be true is if a metadata query is getting executed.- Throws:
StandardException
-
prepareInternalStatement
PreparedStatement prepareInternalStatement(java.lang.String sqlText) throws StandardException
Return a PreparedStatement object for the query. This method first tries to locate the PreparedStatement object from a statement cache. If the statement is not found in the cache, the query will be compiled and put into the cache. The schema used when compiling the statement is the same schema as returned by getDefaultSchema(). For internal statements, the read only status is set to true. Calling this method is equivalent to calling prepareExternalStatement(lcc.getDefaultSchema(), sqlText, true);- Parameters:
sqlText
- sql query string- Throws:
StandardException
-
setOptimizerTracer
void setOptimizerTracer(OptTrace tracer)
Install an optimizer tracer (to enable tracing) or uninstall the current optimizer tracer (to disable tracing).- Parameters:
tracer
- Null if tracing is being turned off, otherwise an optimizer tracer
-
getOptimizerTracer
OptTrace getOptimizerTracer()
Get the optimizer tracer (could be null if we aren't tracing the optimizer).
-
optimizerTracingIsOn
boolean optimizerTracingIsOn()
Get whether or not optimizer trace is on.- Returns:
- Whether or not optimizer trace is on.
-
isTransactionPristine
boolean isTransactionPristine()
Reports whether there is any outstanding work in the transaction.- Returns:
- true if there is outstanding work in the transaction false otherwise
-
lastAutoincrementValue
java.lang.Long lastAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
Returns the last autoincrement value inserted by this connection. If no values have been inserted into the given column a NULL value is returned.- Parameters:
schemaName
-tableName
-columnName
-
-
setAutoincrementUpdate
void setAutoincrementUpdate(boolean flag)
Sets autoincrementUpdate-- this variable allows updates to autoincrement columns if it is set to true. The default is ofcourse false; i.e ai columns cannot be directly modified by the user. This is set to true by AlterTableConstantAction, when a new ai column is being added to an existing table.- Parameters:
flag
- the value for autoincrementUpdate (TRUE or FALSE)
-
getAutoincrementUpdate
boolean getAutoincrementUpdate()
Returns the current value of autoincrementUpdate.- Returns:
- true if updates to autoincrement columns is permitted.
-
copyHashtableToAIHT
void copyHashtableToAIHT(java.util.Map<java.lang.String,java.lang.Long> from)
Copy a map of autoincrement key value pairs into the cache of ai values stored in the language connection context.
-
nextAutoincrementValue
long nextAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName) throws StandardException
returns the next value to be inserted into an autoincrement col. This is used internally by the system to generate autoincrement values which are going to be inserted into a autoincrement column. This is used when as autoincrement column is added to a table by an alter table statemenet and during bulk insert.- Parameters:
schemaName
-tableName
-columnName
- identify the column uniquely in the system.- Throws:
StandardException
- on error.
-
autoincrementFlushCache
void autoincrementFlushCache(UUID tableUUID) throws StandardException
Flush the cache of autoincrement values being kept by the lcc. This will result in the autoincrement values being written to the SYSCOLUMNS table as well as the mapping used by lastAutoincrementValue- Parameters:
tableUUID
- the table which is being flushed; we need this value to identify the table for which the autoincrement counter is being maintained.- Throws:
StandardException
- thrown on error.- See Also:
lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)
,GenericLanguageConnectionContext.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)
-
autoincrementCreateCounter
void autoincrementCreateCounter(java.lang.String s, java.lang.String t, java.lang.String c, java.lang.Long initialValue, long increment, int position)
Create an autoincrement counter to be used on behalf of a SQL-J statement. The counter is identified by (schemaName, tableName, columnName). The counter must be freed up by calling autoincrementFlushCache at the end of the statement. It is expected that a ai-counter with the same signaure doesn't exist when the method is called.- Parameters:
s
- SchemaNamet
- TableNamec
- ColumnNameinitialValue
- initial value of the counter.increment
- increment for the counter.position
- column position (1-based).
-
getInstanceNumber
int getInstanceNumber()
Get the instance number of this LCC.- Returns:
- instance number of this LCC.
-
getDrdaID
java.lang.String getDrdaID()
Get the DRDA ID of this LCC.- Returns:
- DRDA ID this LCC.
-
setDrdaID
void setDrdaID(java.lang.String drdaID)
Set the DRDA ID of this LCC.- Parameters:
drdaID
- DRDA ID.
-
getDbname
java.lang.String getDbname()
Get the database name of this LCC.- Returns:
- database name of this LCC.
-
usesSqlAuthorization
boolean usesSqlAuthorization()
Check if in SQL standard mode, with support for Grant and Revoke- Returns:
- True if SQL standard permissions are being used
-
closeUnusedActivations
void closeUnusedActivations() throws StandardException
Close any unused activations in this connection context.- Throws:
StandardException
-
setCurrentRole
void setCurrentRole(Activation a, java.lang.String role)
Set the current role- Parameters:
a
- activation of set role statementrole
- the id of the role to be set to current
-
getCurrentRoleId
java.lang.String getCurrentRoleId(Activation a)
Get the current role authorization identifier of the dynamic call context associated with this activation.- Parameters:
a
- activation of statement needing current role- Returns:
- String the role id
-
getCurrentRoleIdDelimited
java.lang.String getCurrentRoleIdDelimited(Activation a) throws StandardException
Get the current role authorization identifier in external delimited form (not case normal form) of the dynamic call context associated with this activation.- Parameters:
a
- activation of statement needing current role- Returns:
- String the role id in delimited form (i.e. not internal case normal form)
- Throws:
StandardException
- standard exception policy
-
roleIsSettable
boolean roleIsSettable(Activation a, java.lang.String role) throws StandardException
Checks whether the given role can be legally set for the current user. This method will read (potentially) the dictionary, so it needs a transaction context.- Parameters:
a
- activationrole
- string containing role name- Returns:
- true if the role can be set
- Throws:
StandardException
- standard exception policy
-
pushNestedSessionContext
void pushNestedSessionContext(Activation a, boolean definersRights, java.lang.String definer) throws StandardException
Create a new SQL session context for the current activation on the basis of the existing SQL session context. This happens when a stored procedure or function that can contain SQL is invoked, cf. SQL 2003 section 4.27.3, since this gives rise to a nested connection.Called from generated code, see
StaticMethodCallNode.generatePushNestedSessionContext(org.apache.derby.impl.sql.compile.ActivationClassBuilder, org.apache.derby.iapi.services.compiler.MethodBuilder, boolean, java.lang.String)
.The new SQL session context is also set in the current statement context (of the invocation).
- Parameters:
a
- activation of the statement which performs the call.definersRights
- if the method should run with definer's rightsdefiner
- authorization id of the definer- Throws:
StandardException
- standard error policy- See Also:
StaticMethodCallNode.generatePushNestedSessionContext(org.apache.derby.impl.sql.compile.ActivationClassBuilder, org.apache.derby.iapi.services.compiler.MethodBuilder, boolean, java.lang.String)
,StatementContext.getSQLSessionContext()
,setupSubStatementSessionContext(org.apache.derby.iapi.sql.Activation)
-
popNestedSessionContext
void popNestedSessionContext(Activation a) throws StandardException
If returning from a routine that can execute SQL, perform any actions needed when popping the SQL session context.- Parameters:
a
- activation- Throws:
StandardException
- standard error policy
-
getTopLevelSQLSessionContext
SQLSessionContext getTopLevelSQLSessionContext()
Get the value of top level session context of the top level connection.- Returns:
- the requested session context
-
setupSubStatementSessionContext
void setupSubStatementSessionContext(Activation a) throws StandardException
Used when a statement as part of its operation executes an other statement. In contrast to pushNestedSessionContext, the activation (for the substatement) just inherits the current session context from the parent statements activation, it does not push a new copy on the stack of session contexts. Currently, this is used in the following situations:- With
ALTER TABLE
adding a column which has a default values, the default value for all the existing rows is added using anUPDATE
substatement. - With
ALTER TABLE
adding a a check constraint, we will use a substatementSELECT
to check if all rows satisfy the constraint. ResultSet.insertRow
,updateRow
anddeleteRow
.- During trigger body execution.
- With
-
createSQLSessionContext
SQLSessionContext createSQLSessionContext()
Create a fresh SQLSessionContext for this connection.- Returns:
- new SQLSessionContext
-
setLastQueryTree
void setLastQueryTree(java.lang.Object queryTree)
Debug method for remembering the last query tree.
-
getLastQueryTree
java.lang.Object getLastQueryTree()
Debug method for retrieving the last query tree.
-
getPrintedObjectsMap
java.util.Map<java.lang.Object,java.lang.Object> getPrintedObjectsMap()
Return a map of AST nodes that have already been printed during a compiler phase, so as to be able to avoid printing a node more than once.- Returns:
- the map
- See Also:
QueryTreeNode.treePrint(int)
-
setXplainOnlyMode
void setXplainOnlyMode(boolean onOrOff)
sets the XplainOnlyMode. If a connection is in XplainOnlyMode, then the statements are not actually being executed, but are just being compiled and the runtime statistics collected into the XPLAIN tables. This can be set on and off by calling SYSCS_SET_XPLAIN_MODE.- Parameters:
onOrOff
- true if statements are to be XPLAINed only.
-
getXplainOnlyMode
boolean getXplainOnlyMode()
gets the current set XplainOnlyMode
-
setXplainSchema
void setXplainSchema(java.lang.String schema)
sets the XplainSchema- Parameters:
schema
- the schema to use for storing XPLAIN'd statements null means don't store the xplain information non-null means persistent style, use the indicated schema
-
getXplainSchema
java.lang.String getXplainSchema()
gets the current set XplainSchema- Returns:
- the Schema of Xplain, may be null.
-
setXplainStatement
void setXplainStatement(java.lang.Object key, java.lang.Object stmt)
-
getXplainStatement
java.lang.Object getXplainStatement(java.lang.Object key)
-
setASTVisitor
void setASTVisitor(ASTVisitor visitor)
Set a Visitor which walks the AST at various stages. This is useful for poking user-written inspectors into the parse, bind, and optimize phases.- Parameters:
visitor
- The Visitor which should walk the tree. Could be null.
-
getASTVisitor
ASTVisitor getASTVisitor()
Get the Visitor which should walk the AST.- Returns:
- The Visitor for that phase. Could be null.
-
setInterruptedException
void setInterruptedException(StandardException e)
Set the exception created and associated with the detected interruped status flag.- Parameters:
e
- the created exception
-
getInterruptedException
StandardException getInterruptedException()
Get exception created when we detected interruped status flag.- Returns:
- saved exception
-
getReferencedColumnMap
FormatableBitSet getReferencedColumnMap(TableDescriptor td)
Get the referenced column map for a table- Returns:
- the map
-
setReferencedColumnMap
void setReferencedColumnMap(TableDescriptor td, FormatableBitSet map)
Set the referenced column map for a table- Parameters:
td
- the table descriptormap
- the map
-
setConstraintDeferred
void setConstraintDeferred(Activation a, ConstraintDescriptor cd, boolean deferred) throws StandardException
Set the constraint mode for this constraint todeferred
. Ifdeferred
isfalse
, to immediate checking, iftrue
to deferred checking.- Parameters:
a
- Activationcd
- The descriptor of the constraintdeferred
- The new constraint mode- Throws:
StandardException
-
isEffectivelyDeferred
boolean isEffectivelyDeferred(SQLSessionContext sc, UUID constraintId) throws StandardException
Determines if a check or foreign key constraint has deferred mode.- Parameters:
sc
- The SQL session context for which we are asking the statusconstraintId
- The constraint id we are inquiring about.- Returns:
true
if the constraint is deferred- Throws:
StandardException
- Standard error policy
-
setDeferredAll
void setDeferredAll(Activation a, boolean deferred) throws StandardException
Set the constraint mode of all deferrable constraints to the value ofdeferred
. If the value isfalse
, this method might throw with a constraint violation error, i.e. if some constraint has deferred mode before this call and had seen violations.- Parameters:
a
- The activationdeferred
- The value which holds the constraint mode- Throws:
StandardException
- Standard error policy
-
getDeferredHashTables
java.util.HashMap<UUID,DeferredConstraintsMemory.ValidationInfo> getDeferredHashTables()
Get the set of disk backed hash tables containing any index rows saved for deferred unique/PK constraints in this transaction, keyed by the conglomerate id, or rows saved containing row locations violating rows for deferred check constraints.- Returns:
- the set
-
checkIntegrity
void checkIntegrity() throws StandardException
Check that deferred constraints are valid, if not roll back the transaction.- Throws:
StandardException
-
getCurrentSQLSessionContext
SQLSessionContext getCurrentSQLSessionContext(Activation activation)
Get the SQL session context of the given activation.- Parameters:
activation
- The activation- Returns:
- The SQL session object
-
-