Context, LanguageConnectionContextpublic class GenericLanguageConnectionContext extends ContextImpl implements LanguageConnectionContext
The generic impl does not provide statement caching.
| Modifier and Type | Field | Description |
|---|---|---|
private java.util.ArrayList<Activation> |
acts |
|
private java.util.ArrayList<TempTableInfo> |
allDeclaredGlobalTempTables |
|
private ASTVisitor |
astWalker |
|
protected Authorizer |
authorizer |
|
private java.util.HashMap<java.lang.String,AutoincrementCounter> |
autoincrementCacheHashtable |
|
private java.util.HashMap<java.lang.String,java.lang.Long> |
autoincrementHT |
To support lastAutoincrementValue: This is a hashtable which maps
schemaName,tableName,columnName to a Long value.
|
private boolean |
autoincrementUpdate |
whether to allow updates or not.
|
protected int |
bindCount |
|
private SchemaDescriptor |
cachedInitialDefaultSchemaDescr |
Used to hold the computed value of the initial default schema,
cf logic in initDefaultSchemaDescriptor.
|
protected LanguageConnectionFactory |
connFactory |
|
private int |
currentSavepointLevel |
|
protected DataValueFactory |
dataFactory |
|
private Database |
db |
|
private java.lang.String |
dbname |
|
private boolean |
ddWriteMode |
|
private int |
defaultIsolationLevel |
|
private java.util.HashMap<UUID,DeferredConstraintsMemory.ValidationInfo> |
deferredHashTables |
The set of disk backed hash tables containing any index rows
saved for deferred constraints in this transaction, keyed by the
conglomerate id.
|
private java.lang.String |
drdaID |
|
private boolean |
identityNotNull |
|
private long |
identityVal |
|
private int |
instanceNumber |
|
private StandardException |
interruptedException |
Interrupt status flag of this session's thread, in the form of an
exception created where an interrupt was (last) detected during operation,
null if no interrupt has been seen.
|
protected int |
isolationLevel |
|
private boolean |
isolationLevelExplicitlySet |
|
private boolean |
isolationLevelSetUsingSQLorJDBC |
|
private HeaderPrintWriter |
istream |
|
protected LanguageFactory |
langFactory |
|
private java.lang.Object |
lastQueryTree |
|
private int |
lockEscalationThreshold |
|
private boolean |
logQueryPlan |
|
private boolean |
logStatementText |
|
private int |
maxActsSize |
The maximum size of acts since the last time it was trimmed.
|
protected long |
nextCursorId |
|
protected int |
nextSavepointId |
|
private static int |
NON_XA |
|
protected OptimizerFactory |
of |
|
private OptTrace |
optimizerTracer |
|
protected int |
outermostTrigger |
|
protected int |
prepareIsolationLevel |
|
(package private) java.util.Map<java.lang.Object,java.lang.Object> |
printedObjectsMap |
This holds 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.
|
private int |
queryNestingDepth |
queryNestingDepth is a counter used to keep track of how many calls
have been made to begin read-only nested transactions.
|
private TransactionController |
readOnlyNestedTransaction |
If non-null indicates that a read-only nested
user transaction is in progress.
|
private java.util.WeakHashMap<TableDescriptor,FormatableBitSet> |
referencedColumnMap |
Connection local state for cached
TableDescriptors used
for keeping track of referenced columns for a table during DDL
operations. |
private RunTimeStatistics |
runTimeStatisticsObject |
|
private boolean |
runTimeStatisticsSetting |
|
private java.lang.StringBuffer |
sb |
|
private java.lang.String |
sessionUser |
In contrast to current user id, which may change (inside a routine
executing with definer's rights), the sessionUser is constant in a
session.
|
private StatementContext[] |
statementContexts |
|
private int |
statementDepth |
|
private boolean |
statisticsTiming |
|
private java.util.ArrayList<ExecutionStmtValidator> |
stmtValidators |
|
protected TypeCompilerFactory |
tcf |
|
private SQLSessionContext |
topLevelSSC |
The top SQL session context stack frame (SQL 2003, section
4.37.3), is kept in topLevelSSC.
|
private TransactionController |
tran |
The transaction to use within this language connection context.
|
private java.util.ArrayList<TriggerExecutionContext> |
triggerExecutionContexts |
|
private java.util.ArrayList<TableDescriptor> |
triggerTables |
|
private boolean |
unusedActs |
|
protected java.lang.String |
userName |
|
private static int |
XA_ONE_PHASE |
|
private static int |
XA_TWO_PHASE |
|
private java.lang.String |
xplain_schema |
the current xplain schema.
|
private java.util.Map<java.lang.Object,java.lang.Object> |
xplain_statements |
For each XPLAIN table, this map stores a SQL INSERT statement which
can be prepared and used to insert rows into the table during the
capturing of statistics data into the user XPLAIN tables.
|
private boolean |
xplainOnlyMode |
If xplainOnlyMode is set (via SYSCS_SET_XPLAIN_MODE), then the
connection does not actually execute statements, but only
compiles them, and emits the query plan information into the
XPLAIN tables.
|
ANSI_CASING, ANTI_ANSI_CASING, CONTEXT_ID, dbnameStr, drdaStr, lccStr, MULTI_TRANSACTION_LOCK, NO_SCHEMAS, OUTERMOST_STATEMENT, SINGLE_TRANSACTION_LOCK, SQL92_SCHEMAS, UNKNOWN_CASING, USER_NAME_SCHEMA, xidStr| Constructor | Description |
|---|---|
GenericLanguageConnectionContext(ContextManager cm,
TransactionController tranCtrl,
LanguageFactory lf,
LanguageConnectionFactory lcf,
Database db,
java.lang.String userName,
int instanceNumber,
java.lang.String drdaID,
java.lang.String dbname) |
| 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.
|
java.lang.StringBuffer |
appendErrorInfo() |
|
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) |
Start a Nested User Transaction (NUT) with the store.
|
private boolean |
checkIfAnyActivationHasHoldCursor(java.lang.String tableName) |
check if there are any activations that reference this temporary table
|
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 |
cleanupOnError(java.lang.Throwable error) |
If worse than a transaction error, everything goes; we
rely on other contexts to kill the context manager
for this session.
|
private TableDescriptor |
cleanupTempTableOnCommitOrRollback(TableDescriptor td,
boolean dropAndRedeclare) |
If dropAndRedeclare is true, that means we have come here for temp
tables with on commit delete rows and no held curosr open on them.
|
private void |
clearDeferreds() |
Clear deferred information for this transaction.
|
void |
closeUnusedActivations() |
Close any unused activations in this connection context.
|
void |
commitNestedTransaction() |
commit a nested transaction.
|
private void |
compareConstraintModes(SQLSessionContext nested,
SQLSessionContext caller) |
|
void |
copyHashtableToAIHT(java.util.Map<java.lang.String,java.lang.Long> from) |
Copies an existing autoincrement mapping
into autoincrementHT, the cache of autoincrement values
kept in the languageconnectioncontext.
|
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.
|
private void |
decrementStatementDepth() |
Decrements the statement depth
|
protected void |
doCommit(boolean commitStore,
boolean sync,
int commitflag,
boolean requestedByUser) |
This is where the work on internalCommit(), userCOmmit() and
internalCommitNoSync() actually takes place.
|
private void |
doRollback(boolean xa,
boolean requestedByUser) |
When a rollback happens, the language connection context
will close all open activations and invalidate
their prepared statements.
|
private void |
dropAllDeclaredGlobalTempTables() |
Drop all the declared global temporary tables associated with this
connection.
|
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.
|
private void |
endTransactionActivationHandling(boolean forRollback) |
If we are called as part of rollback code path, then we will reset all
the activations that have resultset returning rows associated with
them.
|
private TempTableInfo |
findDeclaredGlobalTempTable(java.lang.String tableName) |
Find the declared global temporary table in the list of temporary tables known by this connection.
|
private void |
finishDDTransaction() |
Finish the data dictionary transaction, if any.
|
int |
getActivationCount() |
Return the number of activations 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.
|
private SQLSessionContext |
getCurrentSQLSessionContext() |
Return the current SQL session context based on statement context
|
SQLSessionContext |
getCurrentSQLSessionContext(Activation activation) |
Return the current SQL session context of the activation
|
java.lang.String |
getCurrentUserId(Activation a) |
Get the Authorization Id of the current user
|
Database |
getDatabase() |
Returns the Database of this connection.
|
DataDictionary |
getDataDictionary() |
Get the data dictionary
|
DataValueFactory |
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.
|
private SchemaDescriptor |
getInitialDefaultSchemaDescriptor() |
Get the computed value for the initial default schema.
|
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 activation
|
java.lang.Object |
getLastQueryTree() |
Debug method for retrieving the last query tree.
|
int |
getLockEscalationThreshold() |
get the lock escalation threshold.
|
boolean |
getLogQueryPlan() |
Get value of logQueryPlan.
|
boolean |
getLogStatementText() |
Get value of logStatementText.
|
private java.lang.String |
getNameString(java.lang.String prefix,
long number) |
Build a String for a statement name.
|
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 table
|
boolean |
getRunTimeStatisticsMode() |
Get the RUNTIMESTATISTICS mode.
|
RunTimeStatistics |
getRunTimeStatisticsObject() |
Get the RUNTIMESTATISTICS object.
|
java.lang.String |
getSessionUserId() |
Get the session user
|
StatementContext |
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 at compile time with this language
connection context.
|
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 descriptor
|
java.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 XplainOnlyMode
|
java.lang.String |
getXplainSchema() |
gets the current set XplainSchema
|
java.lang.Object |
getXplainStatement(java.lang.Object key) |
|
int |
incrementBindCount() |
Increment the DataDictionary bind count.
|
private void |
incrementStatementDepth() |
Increments the statement depth.
|
protected SchemaDescriptor |
initDefaultSchemaDescriptor() |
Compute the initial default schema and set
cachedInitialDefaultSchemaDescr accordingly.
|
void |
initialize() |
Initialize.
|
void |
internalCommit(boolean commitStore) |
Do a commit as appropriate for an internally generated
commit (e.g. as needed by sync, or autocommit).
|
void |
internalCommitNoSync(int commitflag) |
Commit the language transaction by doing a commitNoSync()
on the store's TransactionController.
|
void |
internalRollback() |
Do a rollback as appropriate for an internally generated
rollback (e.g. as needed by sync, or autocommit).
|
void |
internalRollbackToSavepoint(java.lang.String savepointName,
boolean refreshStyle,
java.lang.Object kindOfSavepoint) |
Let the context deal with a rollback to savepoint
|
private void |
invalidateCleanupDroppedTable(TableDescriptor td) |
Invalidate a dropped temp table
|
boolean |
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 |
isLastHandler(int severity) |
Return whether or not this context is the "last" handler for a
the specified severity level.
|
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) |
lastAutoincrementValue searches for the last autoincrement value inserted
into a column specified by the user.
|
CursorActivation |
lookupCursorActivation(java.lang.String cursorName) |
See if a given cursor is available for use.
|
PreparedStatement |
lookupStatement(GenericStatement statement) |
See if a given statement has already been compiled for this user, and
if so use its prepared statement.
|
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 unused
|
boolean |
optimizerTracingIsOn() |
Get whether or not optimizer trace is on.
|
void |
popCompilerContext(CompilerContext cc) |
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 forMetaData) |
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 schema sd 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 savepoint
|
void |
removeActivation(Activation a) |
Remove the activation to those known about by this connection.
|
void |
removeStatement(GenericStatement statement) |
This method will remove a statement from the statement cache.
|
private void |
replaceDeclaredGlobalTempTable(java.lang.String tableName,
TableDescriptor td) |
This is called at the commit time for temporary tables with
ON COMMIT DELETE ROWS
If a temp table with ON COMMIT DELETE ROWS doesn't have any held cursor
open on them, we delete the data from them by dropping the conglomerate
and recreating the conglomerate.
|
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.
|
private void |
resetSavepoints() |
Reset all statement savepoints.
|
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.
|
protected void |
resetStatementDepth() |
Resets the statementDepth.
|
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 to deferred for the specified constraint.
|
void |
setCurrentRole(Activation a,
java.lang.String role) |
Set the current role
|
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.
|
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 of
deferred. |
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 level) |
|
void |
setReadOnly(boolean on) |
Set the readOnly status for the current connection.
|
void |
setReferencedColumnMap(TableDescriptor td,
FormatableBitSet map) |
Set the referenced column map for a table
|
void |
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.
|
private void |
setupSessionContextMinion(Activation a,
boolean push,
boolean definersRights,
java.lang.String definer) |
|
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 s) |
sets the XplainSchema
|
void |
setXplainStatement(java.lang.Object key,
java.lang.Object stmt) |
|
private void |
tempTablesAndCommit(boolean in_xa_transaction) |
Do the necessary work at commit time for temporary tables
|
private void |
tempTablesAndRollback() |
do the necessary work at rollback time for temporary tables
1)If a temp table was declared in the UOW, then drop it and remove it
from list of temporary tables.
2)If a temp table was declared and dropped in the UOW, then remove it
from list of temporary tables.
3)If an existing temp table was dropped in the UOW, then recreate it
with no data.
4)If an existing temp table was modified in the UOW, then get rid of
all the rows from the table.
|
private void |
tempTablesReleaseSavepointLevels() |
After a release of a savepoint, we need to go through our temp tables
list.
|
private void |
tempTablesXApostCommit() |
|
void |
userCommit() |
Do a commmit as is appropriate for a user requested
commit (e.g. a java.sql.Connection.commit() or a language
'COMMIT' statement.
|
void |
userRollback() |
Do a rollback as is appropriate for a user requested
rollback (e.g. a java.sql.Connection.rollback() or a language
'ROLLBACk' statement.
|
boolean |
usesSqlAuthorization() |
Check if in SQL standard mode, with support for Grant and Revoke
|
private void |
validateDeferredConstraint(ConstraintDescriptor cd) |
Validate a deferred constraint.
|
private void |
validateDeferredConstraints(boolean rollbackOnError) |
Validate all deferred constraints.
|
void |
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) |
Same as userCommit except commit a distributed transaction.
|
void |
xaRollback() |
Same as userRollback() except rolls back a distrubuted transaction.
|
getContextManager, getIdName, popMe, pushMegetContextManager, getIdName, popMe, pushMeprivate static final int NON_XA
private static final int XA_ONE_PHASE
private static final int XA_TWO_PHASE
private final java.util.ArrayList<Activation> acts
private volatile boolean unusedActs
private int maxActsSize
protected int bindCount
private boolean ddWriteMode
private boolean runTimeStatisticsSetting
private boolean statisticsTiming
private boolean xplainOnlyMode
private java.lang.String xplain_schema
private java.util.Map<java.lang.Object,java.lang.Object> xplain_statements
private java.util.ArrayList<TempTableInfo> allDeclaredGlobalTempTables
private int currentSavepointLevel
protected long nextCursorId
protected int nextSavepointId
private RunTimeStatistics runTimeStatisticsObject
private java.lang.StringBuffer sb
private Database db
private final int instanceNumber
private java.lang.String drdaID
private java.lang.String dbname
private java.lang.Object lastQueryTree
private final TransactionController tran
private TransactionController readOnlyNestedTransaction
private int queryNestingDepth
protected DataValueFactory dataFactory
protected LanguageFactory langFactory
protected TypeCompilerFactory tcf
protected OptimizerFactory of
protected LanguageConnectionFactory connFactory
private final StatementContext[] statementContexts
private int statementDepth
protected int outermostTrigger
protected Authorizer authorizer
protected java.lang.String userName
private SQLSessionContext topLevelSSC
getTopLevelSQLSessionContext()private SchemaDescriptor cachedInitialDefaultSchemaDescr
private int defaultIsolationLevel
protected int isolationLevel
private boolean isolationLevelExplicitlySet
private boolean isolationLevelSetUsingSQLorJDBC
protected int prepareIsolationLevel
private boolean logStatementText
private boolean logQueryPlan
private HeaderPrintWriter istream
private int lockEscalationThreshold
private java.util.ArrayList<ExecutionStmtValidator> stmtValidators
private java.util.ArrayList<TriggerExecutionContext> triggerExecutionContexts
private java.util.ArrayList<TableDescriptor> triggerTables
private OptTrace optimizerTracer
private java.util.HashMap<java.lang.String,java.lang.Long> autoincrementHT
private boolean autoincrementUpdate
private long identityVal
private boolean identityNotNull
private java.util.HashMap<java.lang.String,AutoincrementCounter> autoincrementCacheHashtable
private ASTVisitor astWalker
private StandardException interruptedException
private java.util.WeakHashMap<TableDescriptor,FormatableBitSet> referencedColumnMap
TableDescriptors used
for keeping track of referenced columns for a table during DDL
operations.private java.util.HashMap<UUID,DeferredConstraintsMemory.ValidationInfo> deferredHashTables
private java.lang.String sessionUser
java.util.Map<java.lang.Object,java.lang.Object> printedObjectsMap
QueryTreeNode.treePrint(int)public GenericLanguageConnectionContext(ContextManager cm, TransactionController tranCtrl, LanguageFactory lf, LanguageConnectionFactory lcf, Database db, java.lang.String userName, int instanceNumber, java.lang.String drdaID, java.lang.String dbname) throws StandardException
StandardExceptionpublic void initialize()
throws StandardException
LanguageConnectionContextinitialize in interface LanguageConnectionContextStandardException - thrown if something goes wrongprotected SchemaDescriptor initDefaultSchemaDescriptor() throws StandardException
StandardExceptionprivate SchemaDescriptor getInitialDefaultSchemaDescriptor()
public boolean getLogStatementText()
LanguageConnectionContextgetLogStatementText in interface LanguageConnectionContextLanguageConnectionContext.getLogStatementText()public void setLogStatementText(boolean logStatementText)
LanguageConnectionContextsetLogStatementText in interface LanguageConnectionContextlogStatementText - Whether or not logStatementText property is set.LanguageConnectionContext.setLogStatementText(boolean)public boolean getLogQueryPlan()
LanguageConnectionContextgetLogQueryPlan in interface LanguageConnectionContextLanguageConnectionContext.getLogQueryPlan()public boolean usesSqlAuthorization()
LanguageConnectionContextusesSqlAuthorization in interface LanguageConnectionContextLanguageConnectionContext.usesSqlAuthorization()public int getLockEscalationThreshold()
getLockEscalationThreshold in interface LanguageConnectionContextpublic void addActivation(Activation a) throws StandardException
addActivation in interface LanguageConnectionContextStandardExceptionpublic void closeUnusedActivations()
throws StandardException
LanguageConnectionContextcloseUnusedActivations in interface LanguageConnectionContextStandardExceptionpublic void notifyUnusedActivation()
notifyUnusedActivation in interface LanguageConnectionContextpublic boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
LanguageConnectionContextcheckIfAnyDeclaredGlobalTempTablesForThisConnection in interface LanguageConnectionContextLanguageConnectionContext.checkIfAnyDeclaredGlobalTempTablesForThisConnection()public void addDeclaredGlobalTempTable(TableDescriptor td) throws StandardException
LanguageConnectionContextaddDeclaredGlobalTempTable in interface LanguageConnectionContexttd - Corresponding to the temporary tableStandardExceptionLanguageConnectionContext.addDeclaredGlobalTempTable(org.apache.derby.iapi.sql.dictionary.TableDescriptor)public boolean dropDeclaredGlobalTempTable(java.lang.String tableName)
LanguageConnectionContextdropDeclaredGlobalTempTable in interface LanguageConnectionContexttableName - look for this table name in the saved list and drop it if foundLanguageConnectionContext.dropDeclaredGlobalTempTable(java.lang.String)private void tempTablesReleaseSavepointLevels()
private void tempTablesAndCommit(boolean in_xa_transaction)
throws StandardException
1)If a temporary table was marked as dropped in this transaction, then remove it from the list of temp tables for this connection 2)If a temporary table was not dropped in this transaction, then mark it's declared savepoint level and modified savepoint level as -1 3)After savepoint fix up, then handle all ON COMMIT DELETE ROWS with no open held cursor temp tables.
in_xa_transaction - if true, then transaction is an XA transaction,
and special nested transaction may be necessary
to cleanup internal containers supporting the
temp tables at commit time.StandardException - Standard exception policy.private void tempTablesXApostCommit()
throws StandardException
StandardExceptionpublic void resetFromPool()
throws StandardException
resetFromPool in interface LanguageConnectionContextStandardExceptionpublic void setLastQueryTree(java.lang.Object queryTree)
LanguageConnectionContextsetLastQueryTree in interface LanguageConnectionContextpublic java.lang.Object getLastQueryTree()
LanguageConnectionContextgetLastQueryTree in interface LanguageConnectionContextprivate void dropAllDeclaredGlobalTempTables()
throws StandardException
StandardExceptionprivate void tempTablesAndRollback()
throws StandardException
StandardExceptionprivate void invalidateCleanupDroppedTable(TableDescriptor td) throws StandardException
StandardExceptionprivate void replaceDeclaredGlobalTempTable(java.lang.String tableName,
TableDescriptor td)
tableName - Temporary table name whose table descriptor is
getting changedtd - New table descriptor for the temporary tablepublic TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(java.lang.String tableName)
LanguageConnectionContextgetTableDescriptorForDeclaredGlobalTempTable in interface LanguageConnectionContexttableName - Get table descriptor for the passed table nameLanguageConnectionContext.getTableDescriptorForDeclaredGlobalTempTable(java.lang.String)private TempTableInfo findDeclaredGlobalTempTable(java.lang.String tableName)
tableName - look for this table name in the saved listpublic void markTempTableAsModifiedInUnitOfWork(java.lang.String tableName)
LanguageConnectionContextmarkTempTableAsModifiedInUnitOfWork in interface LanguageConnectionContexttableName - Mark the passed temporary table name as modifiedLanguageConnectionContext.markTempTableAsModifiedInUnitOfWork(java.lang.String)public PreparedStatement prepareInternalStatement(SchemaDescriptor compilationSchema, java.lang.String sqlText, boolean isForReadOnly, boolean forMetaData) throws StandardException
LanguageConnectionContextprepareInternalStatement in interface LanguageConnectionContextcompilationSchema - schemasqlText - sql query stringisForReadOnly - read only status for resultset. Set to true if the concurrency mode for the resultset
is CONCUR_READ_ONLYforMetaData - 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.StandardExceptionLanguageConnectionContext.prepareInternalStatement(org.apache.derby.iapi.sql.dictionary.SchemaDescriptor, java.lang.String, boolean, boolean)public PreparedStatement prepareInternalStatement(java.lang.String sqlText) throws StandardException
LanguageConnectionContextprepareInternalStatement in interface LanguageConnectionContextsqlText - sql query stringStandardExceptionLanguageConnectionContext.prepareInternalStatement(org.apache.derby.iapi.sql.dictionary.SchemaDescriptor, java.lang.String, boolean, boolean)public void removeActivation(Activation a)
removeActivation in interface LanguageConnectionContextpublic int getActivationCount()
getActivationCount in interface LanguageConnectionContextpublic CursorActivation lookupCursorActivation(java.lang.String cursorName)
lookupCursorActivation in interface LanguageConnectionContextpublic void removeStatement(GenericStatement statement) throws StandardException
preparedStmt.compilingStatement in the GenericStatement
before calling this method in order to prevent race conditions when
calling CacheManager.remove(Cacheable).statement - Statement to removeStandardException - thrown if lookup goes wrong.public PreparedStatement lookupStatement(GenericStatement statement) throws StandardException
StandardException - thrown if lookup goes wrong.public java.lang.String getUniqueCursorName()
getUniqueCursorName in interface LanguageConnectionContextpublic java.lang.String getUniqueSavepointName()
getUniqueSavepointName in interface LanguageConnectionContextpublic int getUniqueSavepointID()
getUniqueSavepointID in interface LanguageConnectionContextprivate java.lang.String getNameString(java.lang.String prefix,
long number)
prefix - The prefix for the statement name.number - The number to append for uniquenesspublic void internalCommit(boolean commitStore)
throws StandardException
internalCommit in interface LanguageConnectionContextcommitStore - true if we should commit the Store transactionStandardException - thrown on failurepublic void userCommit()
throws StandardException
userCommit in interface LanguageConnectionContextStandardException - thrown on failurepublic final void internalCommitNoSync(int commitflag)
throws StandardException
Do *NOT* tell the data dictionary that the transaction is finished. The reason is that this would allow other transactions to see comitted DDL that could be undone in the event of a system crash.
internalCommitNoSync in interface LanguageConnectionContextcommitflag - the flags to pass to commitNoSync in the store's
TransactionControllerStandardException - thrown on failurepublic final void xaCommit(boolean onePhase)
throws StandardException
xaCommit in interface LanguageConnectionContextonePhase - if true, allow it to commit without first going thru a
prepared state.StandardException - thrown if something goes wrongprotected void doCommit(boolean commitStore,
boolean sync,
int commitflag,
boolean requestedByUser)
throws StandardException
When a commit happens, the language connection context will close all open activations/cursors and commit the Store transaction.
REVISIT: we talked about having a LanguageTransactionContext, but since store transaction management is currently in flux and our context might want to delegate to that context, for now all commit/rollback actions are handled directly by the language connection context. REVISIT: this may need additional alterations when RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT show up.
Since the access manager's own context takes care of its own resources on commit, and the transaction stays open, there is nothing that this context has to do with the transaction controller.
Also, tell the data dictionary that the transaction is finished, if necessary (that is, if the data dictionary was put into DDL mode in this transaction.
commitStore - true if we should commit the Store transactionsync - true means do a synchronized commit,
false means do an unsynchronized commitcommitflag - if this is an unsynchronized commit, the flags to
pass to commitNoSync in the store's
TransactionController. If this is a synchronized
commit, this flag is overloaded for xacommit.requestedByUser - False iff the commit is for internal use and
we should ignore the check to prevent commits
in an atomic statement.StandardException - Thrown on errorprivate TableDescriptor cleanupTempTableOnCommitOrRollback(TableDescriptor td, boolean dropAndRedeclare) throws StandardException
StandardExceptionpublic void internalRollback()
throws StandardException
The invalidated statements can revalidate themselves without a full recompile if they verify their dependencies' providers still exist unchanged. REVISIT when invalidation types are created.
REVISIT: this may need additional alterations when RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT show up.
Also, tell the data dictionary that the transaction is finished, if necessary (that is, if the data dictionary was put into DDL mode in this transaction.
internalRollback in interface LanguageConnectionContextStandardException - thrown on failurepublic void userRollback()
throws StandardException
userRollback in interface LanguageConnectionContextStandardException - thrown on failurepublic void xaRollback()
throws StandardException
xaRollback in interface LanguageConnectionContextStandardException - thrown if something goes wrongprivate void doRollback(boolean xa,
boolean requestedByUser)
throws StandardException
The invalidated statements can revalidate themselves without a full recompile if they verify their dependencies' providers still exist unchanged. REVISIT when invalidation types are created.
REVISIT: this may need additional alterations when RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT show up.
Also, tell the data dictionary that the transaction is finished, if necessary (that is, if the data dictionary was put into DDL mode in this transaction.
xa - true if this is an xa rollbackrequestedByUser - true if requested by userStandardException - thrown on failureprivate void resetSavepoints()
throws StandardException
StandardException - thrown if something goes wrongpublic void internalRollbackToSavepoint(java.lang.String savepointName,
boolean refreshStyle,
java.lang.Object kindOfSavepoint)
throws StandardException
internalRollbackToSavepoint in interface LanguageConnectionContextsavepointName - 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 savepointStandardException - thrown if something goes wrongpublic void releaseSavePoint(java.lang.String savepointName,
java.lang.Object kindOfSavepoint)
throws StandardException
releaseSavePoint in interface LanguageConnectionContextsavepointName - 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 savepointStandardException - thrown if something goes wrongpublic void languageSetSavePoint(java.lang.String savepointName,
java.lang.Object kindOfSavepoint)
throws StandardException
languageSetSavePoint in interface LanguageConnectionContextsavepointName - 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 savepointStandardException - thrown if something goes wrongpublic void beginNestedTransaction(boolean readOnly)
throws StandardException
beginNestedTransaction in interface LanguageConnectionContextreadOnly - The nested transaction would be read only if param value trueStandardException - on error.TransactionController.startNestedUserTransaction(boolean, boolean)public void commitNestedTransaction()
throws StandardException
LanguageConnectionContextcommitNestedTransaction in interface LanguageConnectionContextStandardException - thrown on erroTransactionController.startNestedUserTransaction(boolean, boolean)public final TransactionController getTransactionCompile()
getTransactionCompile in interface LanguageConnectionContextpublic TransactionController getTransactionExecute()
LanguageConnectionContextgetTransactionExecute in interface LanguageConnectionContextpublic DataValueFactory getDataValueFactory()
getDataValueFactory in interface LanguageConnectionContextpublic LanguageFactory getLanguageFactory()
getLanguageFactory in interface LanguageConnectionContextpublic OptimizerFactory getOptimizerFactory()
LanguageConnectionContextgetOptimizerFactory in interface LanguageConnectionContextpublic LanguageConnectionFactory getLanguageConnectionFactory()
getLanguageConnectionFactory in interface LanguageConnectionContextprivate boolean checkIfAnyActivationHasHoldCursor(java.lang.String tableName)
throws StandardException
tableName - look for any activations referencing this table nameStandardExceptionpublic boolean verifyAllHeldResultSetsAreClosed()
throws StandardException
verifyAllHeldResultSetsAreClosed in interface LanguageConnectionContextStandardException - thrown on failurepublic boolean verifyNoOpenResultSets(PreparedStatement pStmt, Provider provider, int action) throws StandardException
verifyNoOpenResultSets in interface LanguageConnectionContextpStmt - The prepared Statementprovider - The object precipitating a possible invalidationaction - The action causing the possible invalidationStandardException - thrown on failurepublic java.lang.String getSessionUserId()
getSessionUserId in interface LanguageConnectionContextpublic SchemaDescriptor getDefaultSchema()
LanguageConnectionContextgetDefaultSchema in interface LanguageConnectionContextLanguageConnectionContext.getDefaultSchema()public SchemaDescriptor getDefaultSchema(Activation a)
LanguageConnectionContextgetDefaultSchema in interface LanguageConnectionContexta - current activationLanguageConnectionContext.getDefaultSchema(Activation a)public java.lang.String getCurrentSchemaName()
LanguageConnectionContextgetCurrentSchemaName in interface LanguageConnectionContextLanguageConnectionContext.getCurrentSchemaName()public java.lang.String getCurrentSchemaName(Activation a)
LanguageConnectionContextgetCurrentSchemaName in interface LanguageConnectionContextLanguageConnectionContext.getCurrentSchemaName(Activation a)public boolean isInitialDefaultSchema(java.lang.String schemaName)
LanguageConnectionContextisInitialDefaultSchema in interface LanguageConnectionContextLanguageConnectionContext.isInitialDefaultSchema(java.lang.String)public void setDefaultSchema(SchemaDescriptor sd) throws StandardException
LanguageConnectionContextsetDefaultSchema in interface LanguageConnectionContextsd - the new default schema.
If null, then the default schema descriptor is used.StandardException - thrown on failureLanguageConnectionContext.setDefaultSchema(SchemaDescriptor sd)public void setDefaultSchema(Activation a, SchemaDescriptor sd) throws StandardException
LanguageConnectionContextsetDefaultSchema in interface LanguageConnectionContexta - current activationsd - the new default schema.
If null, then the default schema descriptor is used.StandardException - thrown on failureLanguageConnectionContext.setDefaultSchema(Activation a,
SchemaDescriptor sd)public void resetSchemaUsages(Activation activation, java.lang.String schemaName) throws StandardException
LanguageConnectionContextresetSchemaUsages in interface LanguageConnectionContextactivation - current activationschemaName - the schema name occurences of which is to be resetStandardExceptionLanguageConnectionContext.resetSchemaUsages(Activation activation,
String schemaName)public java.lang.Long getIdentityValue()
getIdentityValue in interface LanguageConnectionContextpublic void setIdentityValue(long val)
setIdentityValue in interface LanguageConnectionContextval - the generated identity column valuepublic final CompilerContext pushCompilerContext()
pushCompilerContext in interface LanguageConnectionContextpublic CompilerContext pushCompilerContext(SchemaDescriptor sd)
pushCompilerContext in interface LanguageConnectionContextsd - the default schemapublic void popCompilerContext(CompilerContext cc)
popCompilerContext in interface LanguageConnectionContextcc - The compiler context.public StatementContext pushStatementContext(boolean isAtomic, boolean isForReadOnly, java.lang.String stmtText, ParameterValueSet pvs, boolean rollbackParentContext, long timeoutMillis)
pushStatementContext in interface LanguageConnectionContextisAtomic - whether this statement is atomic or notisForReadOnly - whether this statement is for a read only resultsetstmtText - 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.
The value 0 means that no timeout is set.public void popStatementContext(StatementContext statementContext, java.lang.Throwable error)
popStatementContext in interface LanguageConnectionContextstatementContext - The statement context.error - The error, if any (Only relevant for DEBUG)public void pushExecutionStmtValidator(ExecutionStmtValidator validator)
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.
pushExecutionStmtValidator in interface LanguageConnectionContextvalidator - the validator to addpublic void popExecutionStmtValidator(ExecutionStmtValidator validator) throws StandardException
popExecutionStmtValidator in interface LanguageConnectionContextvalidator - the validator to removeStandardException - on errorpublic void pushTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
Multiple TriggerExecutionContexts may be active at any given time.
pushTriggerExecutionContext in interface LanguageConnectionContexttec - the trigger execution contextStandardException - on trigger recursion errorpublic void popTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
popTriggerExecutionContext in interface LanguageConnectionContexttec - the tec to removeStandardException - on errorpublic TriggerExecutionContext getTriggerExecutionContext()
getTriggerExecutionContext in interface LanguageConnectionContextpublic void validateStmtExecution(ConstantAction constantAction) throws StandardException
validateStmtExecution in interface LanguageConnectionContextconstantAction - the constantAction that is about to be executed (and
should be validatedStandardException - on validation failurepublic void pushTriggerTable(TableDescriptor td)
pushTriggerTable in interface LanguageConnectionContexttd - the table that the trigger is
defined uponpublic void popTriggerTable(TableDescriptor td)
popTriggerTable in interface LanguageConnectionContexttd - the table to remove from the stack.public TableDescriptor getTriggerTable()
getTriggerTable in interface LanguageConnectionContextpublic Database getDatabase()
LanguageConnectionContextgetDatabase in interface LanguageConnectionContextLanguageConnectionContext.getDatabase()public int incrementBindCount()
LanguageConnectionContextincrementBindCount in interface LanguageConnectionContextLanguageConnectionContext.incrementBindCount()public int decrementBindCount()
LanguageConnectionContextdecrementBindCount in interface LanguageConnectionContextLanguageConnectionContext.decrementBindCount()public int getBindCount()
LanguageConnectionContextgetBindCount in interface LanguageConnectionContextLanguageConnectionContext.getBindCount()public final void setDataDictionaryWriteMode()
LanguageConnectionContextsetDataDictionaryWriteMode in interface LanguageConnectionContextLanguageConnectionContext.setDataDictionaryWriteMode()public final boolean dataDictionaryInWriteMode()
LanguageConnectionContextdataDictionaryInWriteMode in interface LanguageConnectionContextLanguageConnectionContext.dataDictionaryInWriteMode()public final void setRunTimeStatisticsMode(boolean onOrOff)
LanguageConnectionContextsetRunTimeStatisticsMode in interface LanguageConnectionContextLanguageConnectionContext.setRunTimeStatisticsMode(boolean)public boolean getRunTimeStatisticsMode()
LanguageConnectionContextgetRunTimeStatisticsMode in interface LanguageConnectionContextLanguageConnectionContext.getRunTimeStatisticsMode()public void setStatisticsTiming(boolean onOrOff)
LanguageConnectionContextsetStatisticsTiming in interface LanguageConnectionContextLanguageConnectionContext.setStatisticsTiming(boolean)public boolean getStatisticsTiming()
LanguageConnectionContextgetStatisticsTiming in interface LanguageConnectionContextLanguageConnectionContext.getStatisticsTiming()public void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
LanguageConnectionContextsetRunTimeStatisticsObject in interface LanguageConnectionContextLanguageConnectionContext.setRunTimeStatisticsObject(org.apache.derby.iapi.sql.execute.RunTimeStatistics)public RunTimeStatistics getRunTimeStatisticsObject()
LanguageConnectionContextgetRunTimeStatisticsObject in interface LanguageConnectionContextLanguageConnectionContext.getRunTimeStatisticsObject()public int getStatementDepth()
getStatementDepth in interface LanguageConnectionContextpublic boolean isIsolationLevelSetUsingSQLorJDBC()
LanguageConnectionContextisIsolationLevelSetUsingSQLorJDBC in interface LanguageConnectionContextLanguageConnectionContext.isIsolationLevelSetUsingSQLorJDBC()public void resetIsolationLevelFlagUsedForSQLandJDBC()
LanguageConnectionContextresetIsolationLevelFlagUsedForSQLandJDBC in interface LanguageConnectionContextLanguageConnectionContext.resetIsolationLevelFlagUsedForSQLandJDBC()public void setIsolationLevel(int isolationLevel)
throws StandardException
LanguageConnectionContextsetIsolationLevel in interface LanguageConnectionContextisolationLevel - The new isolationLevel.StandardExceptionLanguageConnectionContext.setIsolationLevel(int)public int getCurrentIsolationLevel()
LanguageConnectionContextgetCurrentIsolationLevel in interface LanguageConnectionContextLanguageConnectionContext.getCurrentIsolationLevel()public java.lang.String getCurrentIsolationLevelStr()
LanguageConnectionContextgetCurrentIsolationLevelStr in interface LanguageConnectionContextLanguageConnectionContext.getCurrentIsolationLevel()public void setPrepareIsolationLevel(int level)
setPrepareIsolationLevel in interface LanguageConnectionContextLanguageConnectionContext.setPrepareIsolationLevel(int)public int getPrepareIsolationLevel()
LanguageConnectionContextgetPrepareIsolationLevel in interface LanguageConnectionContextLanguageConnectionContext.getPrepareIsolationLevel()public StatementContext getStatementContext()
LanguageConnectionContextgetStatementContext in interface LanguageConnectionContextLanguageConnectionContext.getStatementContext()public void setOptimizerTracer(OptTrace tracer)
LanguageConnectionContextsetOptimizerTracer in interface LanguageConnectionContexttracer - Null if tracing is being turned off, otherwise an optimizer tracerLanguageConnectionContext.setOptimizerTracer(org.apache.derby.iapi.sql.compile.OptTrace)public OptTrace getOptimizerTracer()
LanguageConnectionContextgetOptimizerTracer in interface LanguageConnectionContextLanguageConnectionContext.getOptimizerTracer()public boolean optimizerTracingIsOn()
LanguageConnectionContextoptimizerTracingIsOn in interface LanguageConnectionContextLanguageConnectionContext.optimizerTracingIsOn()public boolean isTransactionPristine()
isTransactionPristine in interface LanguageConnectionContextpublic void cleanupOnError(java.lang.Throwable error)
throws StandardException
If a transaction error, act like we saw a rollback.
If more severe or a java error, the outer cleanup will shutdown the connection, so we don't have to clean up.
REMIND: connection should throw out all contexts and start over when the connection is closed... perhaps by throwing out the context manager?
REVISIT: If statement error, should we do anything?
Since the access manager's own context takes care of its own resources on errors, there is nothing that this context has to do with the transaction controller.
cleanupOnError in interface ContextStandardException - thrown on error. REVISIT: don't want
cleanupOnError's to throw exceptions.public boolean isLastHandler(int severity)
ContextisLastHandler in interface ContextisLastHandler in class ContextImplContext.isLastHandler(int)private void endTransactionActivationHandling(boolean forRollback)
throws StandardException
StandardException - thrown on failureprivate void finishDDTransaction()
throws StandardException
StandardException - Thrown on errorprivate void incrementStatementDepth()
private void decrementStatementDepth()
protected void resetStatementDepth()
public DataDictionary getDataDictionary()
LanguageConnectionContextgetDataDictionary in interface LanguageConnectionContextpublic void setReadOnly(boolean on)
throws StandardException
LanguageConnectionContextsetReadOnly in interface LanguageConnectionContexton - true sets the connection to be readOnly and
false sets it to readWrite.StandardException - The operation is disallowed.LanguageConnectionContext.setReadOnly(boolean)public boolean isReadOnly()
LanguageConnectionContextisReadOnly in interface LanguageConnectionContextLanguageConnectionContext.isReadOnly()public Authorizer getAuthorizer()
LanguageConnectionContextgetAuthorizer in interface LanguageConnectionContextLanguageConnectionContext.getAuthorizer()public java.lang.Long lastAutoincrementValue(java.lang.String schemaName,
java.lang.String tableName,
java.lang.String columnName)
lastAutoincrementValue in interface LanguageConnectionContextLanguageConnectionContext.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)public void setAutoincrementUpdate(boolean flag)
LanguageConnectionContextsetAutoincrementUpdate in interface LanguageConnectionContextflag - the value for autoincrementUpdate (TRUE or FALSE)LanguageConnectionContext.setAutoincrementUpdate(boolean)public boolean getAutoincrementUpdate()
LanguageConnectionContextgetAutoincrementUpdate in interface LanguageConnectionContextLanguageConnectionContext.getAutoincrementUpdate()public void autoincrementCreateCounter(java.lang.String s,
java.lang.String t,
java.lang.String c,
java.lang.Long initialValue,
long increment,
int position)
LanguageConnectionContextautoincrementCreateCounter in interface LanguageConnectionContexts - SchemaNamet - TableNamec - ColumnNameinitialValue - initial value of the counter.increment - increment for the counter.position - column position (1-based).LanguageConnectionContext.autoincrementCreateCounter(java.lang.String, java.lang.String, java.lang.String, java.lang.Long, long, int)public long nextAutoincrementValue(java.lang.String schemaName,
java.lang.String tableName,
java.lang.String columnName)
throws StandardException
nextAutoincrementValue in interface LanguageConnectionContextschemaName - tableName - columnName - identify the column uniquely in the system.StandardException - on error.public void autoincrementFlushCache(UUID tableUUID) throws StandardException
autoincrementFlushCache in interface LanguageConnectionContexttableUUID - the table which is being flushed; we need this value to
identify the table for which the autoincrement counter is being
maintained.StandardException - thrown on error.LanguageConnectionContext.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String),
lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)public void copyHashtableToAIHT(java.util.Map<java.lang.String,java.lang.Long> from)
copyHashtableToAIHT in interface LanguageConnectionContextpublic int getInstanceNumber()
LanguageConnectionContextgetInstanceNumber in interface LanguageConnectionContextLanguageConnectionContext.getInstanceNumber()public java.lang.String getDrdaID()
LanguageConnectionContextgetDrdaID in interface LanguageConnectionContextLanguageConnectionContext.getDrdaID()public void setDrdaID(java.lang.String drdaID)
LanguageConnectionContextsetDrdaID in interface LanguageConnectionContextdrdaID - DRDA ID.LanguageConnectionContext.setDrdaID(java.lang.String)public java.lang.String getDbname()
LanguageConnectionContextgetDbname in interface LanguageConnectionContextLanguageConnectionContext.getDbname()public Activation getLastActivation()
LanguageConnectionContextgetLastActivation in interface LanguageConnectionContextLanguageConnectionContext.getLastActivation()public java.lang.StringBuffer appendErrorInfo()
appendErrorInfo in class ContextImplpublic void setCurrentRole(Activation a, java.lang.String role)
LanguageConnectionContextsetCurrentRole in interface LanguageConnectionContexta - activation of set role statementrole - the id of the role to be set to currentLanguageConnectionContext.setCurrentRole(Activation a, String role)public java.lang.String getCurrentRoleId(Activation a)
LanguageConnectionContextgetCurrentRoleId in interface LanguageConnectionContexta - activation of statement needing current roleLanguageConnectionContext.getCurrentRoleId(Activation a)public java.lang.String getCurrentUserId(Activation a)
LanguageConnectionContextgetCurrentUserId in interface LanguageConnectionContexta - activationLanguageConnectionContext.getCurrentUserId(Activation a)public java.lang.String getCurrentRoleIdDelimited(Activation a) throws StandardException
LanguageConnectionContextgetCurrentRoleIdDelimited in interface LanguageConnectionContexta - activation of statement needing current roleStandardException - standard exception policyLanguageConnectionContext.getCurrentRoleIdDelimited(Activation a)public boolean roleIsSettable(Activation a, java.lang.String role) throws StandardException
LanguageConnectionContextroleIsSettable in interface LanguageConnectionContexta - activationrole - string containing role nameStandardException - standard exception policyLanguageConnectionContext.roleIsSettable(Activation a, String role)public SQLSessionContext getCurrentSQLSessionContext(Activation activation)
getCurrentSQLSessionContext in interface LanguageConnectionContextactivation - the activationprivate SQLSessionContext getCurrentSQLSessionContext()
public void pushNestedSessionContext(Activation a, boolean definersRights, java.lang.String definer) throws StandardException
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).
pushNestedSessionContext in interface LanguageConnectionContexta - activation of the statement which performs the call.definersRights - if the method should run with definer's rightsdefiner - authorization id of the definerStandardException - standard error policyStaticMethodCallNode.generatePushNestedSessionContext(org.apache.derby.impl.sql.compile.ActivationClassBuilder, org.apache.derby.iapi.services.compiler.MethodBuilder, boolean, java.lang.String),
StatementContext.getSQLSessionContext(),
LanguageConnectionContext.setupSubStatementSessionContext(org.apache.derby.iapi.sql.Activation)private void setupSessionContextMinion(Activation a, boolean push, boolean definersRights, java.lang.String definer) throws StandardException
StandardExceptionpublic void popNestedSessionContext(Activation a) throws StandardException
LanguageConnectionContextpopNestedSessionContext in interface LanguageConnectionContexta - activationStandardException - standard error policyprivate void compareConstraintModes(SQLSessionContext nested, SQLSessionContext caller) throws StandardException
StandardExceptionpublic boolean isEffectivelyDeferred(SQLSessionContext sc, UUID constraintId) throws StandardException
LanguageConnectionContextisEffectivelyDeferred in interface LanguageConnectionContextsc - The SQL session context for which we are asking the statusconstraintId - The constraint id we are inquiring about.true if the constraint is deferredStandardException - Standard error policypublic void setupSubStatementSessionContext(Activation a) throws StandardException
LanguageConnectionContextALTER TABLE adding a column which has a default
values, the default value for all the existing rows is added
using an UPDATE substatement.
ALTER TABLE adding a a check constraint, we will use
a substatement SELECT to check if all rows satisfy the
constraint.
ResultSet.insertRow, updateRow
and deleteRow.
setupSubStatementSessionContext in interface LanguageConnectionContextStandardExceptionLanguageConnectionContext.setupSubStatementSessionContext(Activation a)public SQLSessionContext getTopLevelSQLSessionContext()
LanguageConnectionContextgetTopLevelSQLSessionContext in interface LanguageConnectionContexttopLevelSSCpublic SQLSessionContext createSQLSessionContext()
LanguageConnectionContextcreateSQLSessionContext in interface LanguageConnectionContextLanguageConnectionContext.createSQLSessionContext()public java.util.Map<java.lang.Object,java.lang.Object> getPrintedObjectsMap()
LanguageConnectionContextgetPrintedObjectsMap in interface LanguageConnectionContextLanguageConnectionContext.getPrintedObjectsMap()public boolean getXplainOnlyMode()
LanguageConnectionContextgetXplainOnlyMode in interface LanguageConnectionContextLanguageConnectionContext.getXplainOnlyMode()public void setXplainOnlyMode(boolean onOrOff)
LanguageConnectionContextsetXplainOnlyMode in interface LanguageConnectionContextonOrOff - true if statements are to be XPLAINed only.LanguageConnectionContext.setXplainOnlyMode(boolean)public java.lang.String getXplainSchema()
LanguageConnectionContextgetXplainSchema in interface LanguageConnectionContextLanguageConnectionContext.getXplainSchema()public void setXplainSchema(java.lang.String s)
LanguageConnectionContextsetXplainSchema in interface LanguageConnectionContexts - 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 schemaLanguageConnectionContext.setXplainSchema(String)public void setXplainStatement(java.lang.Object key,
java.lang.Object stmt)
setXplainStatement in interface LanguageConnectionContextpublic java.lang.Object getXplainStatement(java.lang.Object key)
getXplainStatement in interface LanguageConnectionContextpublic void setASTVisitor(ASTVisitor visitor)
LanguageConnectionContextsetASTVisitor in interface LanguageConnectionContextvisitor - The Visitor which should walk the tree. Could be null.public ASTVisitor getASTVisitor()
LanguageConnectionContextgetASTVisitor in interface LanguageConnectionContextpublic void setInterruptedException(StandardException e)
LanguageConnectionContextsetInterruptedException in interface LanguageConnectionContexte - the created exceptionpublic StandardException getInterruptedException()
LanguageConnectionContextgetInterruptedException in interface LanguageConnectionContextpublic FormatableBitSet getReferencedColumnMap(TableDescriptor td)
LanguageConnectionContextgetReferencedColumnMap in interface LanguageConnectionContextpublic void setReferencedColumnMap(TableDescriptor td, FormatableBitSet map)
LanguageConnectionContextsetReferencedColumnMap in interface LanguageConnectionContexttd - the table descriptormap - the mappublic void setConstraintDeferred(Activation a, ConstraintDescriptor cd, boolean deferred) throws StandardException
setConstraintDeferred in interface LanguageConnectionContexta - activationcd - the constraint descriptordeferred - the constraint modeStandardException - standard error policypublic void checkIntegrity()
throws StandardException
LanguageConnectionContextcheckIntegrity in interface LanguageConnectionContextStandardExceptionprivate void clearDeferreds()
public void setDeferredAll(Activation a, boolean deferred) throws StandardException
LanguageConnectionContextdeferred. If the value is false, this method might
throw with a constraint violation error, i.e. if some constraint
has deferred mode before this call and had seen violations.setDeferredAll in interface LanguageConnectionContexta - The activationdeferred - The value which holds the constraint modeStandardException - Standard error policypublic java.util.HashMap<UUID,DeferredConstraintsMemory.ValidationInfo> getDeferredHashTables()
LanguageConnectionContextgetDeferredHashTables in interface LanguageConnectionContextprivate void validateDeferredConstraints(boolean rollbackOnError)
throws StandardException
StandardExceptionprivate void validateDeferredConstraint(ConstraintDescriptor cd) throws StandardException
cd - the descriptor of the constraint to validateStandardExceptionApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.