public class GenericLanguageConnectionContext extends ContextImpl implements LanguageConnectionContext
The generic impl does not provide statement caching.
Modifier and Type | Field and 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
TableDescriptor s 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 and 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 and 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(SchemaDescriptor compilationSchema,
java.lang.String sqlText,
boolean isForReadOnly,
boolean forMetaData)
Return a PreparedStatement object for the query.
|
PreparedStatement |
prepareInternalStatement(java.lang.String sqlText)
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
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.
|
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, pushMe
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContextManager, getIdName, popMe, pushMe
private 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
TableDescriptor
s 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
StandardException
public void initialize() throws StandardException
LanguageConnectionContext
initialize
in interface LanguageConnectionContext
StandardException
- thrown if something goes wrongprotected SchemaDescriptor initDefaultSchemaDescriptor() throws StandardException
StandardException
private SchemaDescriptor getInitialDefaultSchemaDescriptor()
public boolean getLogStatementText()
LanguageConnectionContext
getLogStatementText
in interface LanguageConnectionContext
LanguageConnectionContext.getLogStatementText()
public void setLogStatementText(boolean logStatementText)
LanguageConnectionContext
setLogStatementText
in interface LanguageConnectionContext
logStatementText
- Whether or not logStatementText property is set.LanguageConnectionContext.setLogStatementText(boolean)
public boolean getLogQueryPlan()
LanguageConnectionContext
getLogQueryPlan
in interface LanguageConnectionContext
LanguageConnectionContext.getLogQueryPlan()
public boolean usesSqlAuthorization()
LanguageConnectionContext
usesSqlAuthorization
in interface LanguageConnectionContext
LanguageConnectionContext.usesSqlAuthorization()
public int getLockEscalationThreshold()
getLockEscalationThreshold
in interface LanguageConnectionContext
public void addActivation(Activation a) throws StandardException
addActivation
in interface LanguageConnectionContext
StandardException
public void closeUnusedActivations() throws StandardException
LanguageConnectionContext
closeUnusedActivations
in interface LanguageConnectionContext
StandardException
public void notifyUnusedActivation()
notifyUnusedActivation
in interface LanguageConnectionContext
public boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
LanguageConnectionContext
checkIfAnyDeclaredGlobalTempTablesForThisConnection
in interface LanguageConnectionContext
LanguageConnectionContext.checkIfAnyDeclaredGlobalTempTablesForThisConnection()
public void addDeclaredGlobalTempTable(TableDescriptor td) throws StandardException
LanguageConnectionContext
addDeclaredGlobalTempTable
in interface LanguageConnectionContext
td
- Corresponding to the temporary tableStandardException
LanguageConnectionContext.addDeclaredGlobalTempTable(org.apache.derby.iapi.sql.dictionary.TableDescriptor)
public boolean dropDeclaredGlobalTempTable(java.lang.String tableName)
LanguageConnectionContext
dropDeclaredGlobalTempTable
in interface LanguageConnectionContext
tableName
- 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
StandardException
public void resetFromPool() throws StandardException
resetFromPool
in interface LanguageConnectionContext
StandardException
public void setLastQueryTree(java.lang.Object queryTree)
LanguageConnectionContext
setLastQueryTree
in interface LanguageConnectionContext
public java.lang.Object getLastQueryTree()
LanguageConnectionContext
getLastQueryTree
in interface LanguageConnectionContext
private void dropAllDeclaredGlobalTempTables() throws StandardException
StandardException
private void tempTablesAndRollback() throws StandardException
StandardException
private void invalidateCleanupDroppedTable(TableDescriptor td) throws StandardException
StandardException
private 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)
LanguageConnectionContext
getTableDescriptorForDeclaredGlobalTempTable
in interface LanguageConnectionContext
tableName
- 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)
LanguageConnectionContext
markTempTableAsModifiedInUnitOfWork
in interface LanguageConnectionContext
tableName
- 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
LanguageConnectionContext
prepareInternalStatement
in interface LanguageConnectionContext
compilationSchema
- 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.StandardException
LanguageConnectionContext.prepareInternalStatement(org.apache.derby.iapi.sql.dictionary.SchemaDescriptor, java.lang.String, boolean, boolean)
public PreparedStatement prepareInternalStatement(java.lang.String sqlText) throws StandardException
LanguageConnectionContext
prepareInternalStatement
in interface LanguageConnectionContext
sqlText
- sql query stringStandardException
LanguageConnectionContext.prepareInternalStatement(org.apache.derby.iapi.sql.dictionary.SchemaDescriptor, java.lang.String, boolean, boolean)
public void removeActivation(Activation a)
removeActivation
in interface LanguageConnectionContext
public int getActivationCount()
getActivationCount
in interface LanguageConnectionContext
public CursorActivation lookupCursorActivation(java.lang.String cursorName)
lookupCursorActivation
in interface LanguageConnectionContext
public 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 LanguageConnectionContext
public java.lang.String getUniqueSavepointName()
getUniqueSavepointName
in interface LanguageConnectionContext
public int getUniqueSavepointID()
getUniqueSavepointID
in interface LanguageConnectionContext
private 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 LanguageConnectionContext
commitStore
- true if we should commit the Store transactionStandardException
- thrown on failurepublic void userCommit() throws StandardException
userCommit
in interface LanguageConnectionContext
StandardException
- 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 LanguageConnectionContext
commitflag
- the flags to pass to commitNoSync in the store's
TransactionControllerStandardException
- thrown on failurepublic final void xaCommit(boolean onePhase) throws StandardException
xaCommit
in interface LanguageConnectionContext
onePhase
- 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
StandardException
public 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 LanguageConnectionContext
StandardException
- thrown on failurepublic void userRollback() throws StandardException
userRollback
in interface LanguageConnectionContext
StandardException
- thrown on failurepublic void xaRollback() throws StandardException
xaRollback
in interface LanguageConnectionContext
StandardException
- 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 LanguageConnectionContext
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 savepointStandardException
- thrown if something goes wrongpublic void releaseSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint) throws StandardException
releaseSavePoint
in interface LanguageConnectionContext
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 savepointStandardException
- thrown if something goes wrongpublic void languageSetSavePoint(java.lang.String savepointName, java.lang.Object kindOfSavepoint) throws StandardException
languageSetSavePoint
in interface LanguageConnectionContext
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 savepointStandardException
- thrown if something goes wrongpublic void beginNestedTransaction(boolean readOnly) throws StandardException
beginNestedTransaction
in interface LanguageConnectionContext
readOnly
- The nested transaction would be read only if param value trueStandardException
- on error.TransactionController.startNestedUserTransaction(boolean, boolean)
public void commitNestedTransaction() throws StandardException
LanguageConnectionContext
commitNestedTransaction
in interface LanguageConnectionContext
StandardException
- thrown on erroTransactionController.startNestedUserTransaction(boolean, boolean)
public final TransactionController getTransactionCompile()
getTransactionCompile
in interface LanguageConnectionContext
public TransactionController getTransactionExecute()
LanguageConnectionContext
getTransactionExecute
in interface LanguageConnectionContext
public DataValueFactory getDataValueFactory()
getDataValueFactory
in interface LanguageConnectionContext
public LanguageFactory getLanguageFactory()
getLanguageFactory
in interface LanguageConnectionContext
public OptimizerFactory getOptimizerFactory()
LanguageConnectionContext
getOptimizerFactory
in interface LanguageConnectionContext
public LanguageConnectionFactory getLanguageConnectionFactory()
getLanguageConnectionFactory
in interface LanguageConnectionContext
private boolean checkIfAnyActivationHasHoldCursor(java.lang.String tableName) throws StandardException
tableName
- look for any activations referencing this table nameStandardException
public boolean verifyAllHeldResultSetsAreClosed() throws StandardException
verifyAllHeldResultSetsAreClosed
in interface LanguageConnectionContext
StandardException
- thrown on failurepublic boolean verifyNoOpenResultSets(PreparedStatement pStmt, Provider provider, int action) throws StandardException
verifyNoOpenResultSets
in interface LanguageConnectionContext
pStmt
- 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 LanguageConnectionContext
public SchemaDescriptor getDefaultSchema()
LanguageConnectionContext
getDefaultSchema
in interface LanguageConnectionContext
LanguageConnectionContext.getDefaultSchema()
public SchemaDescriptor getDefaultSchema(Activation a)
LanguageConnectionContext
getDefaultSchema
in interface LanguageConnectionContext
a
- current activationLanguageConnectionContext.getDefaultSchema(Activation a)
public java.lang.String getCurrentSchemaName()
LanguageConnectionContext
getCurrentSchemaName
in interface LanguageConnectionContext
LanguageConnectionContext.getCurrentSchemaName()
public java.lang.String getCurrentSchemaName(Activation a)
LanguageConnectionContext
getCurrentSchemaName
in interface LanguageConnectionContext
LanguageConnectionContext.getCurrentSchemaName(Activation a)
public boolean isInitialDefaultSchema(java.lang.String schemaName)
LanguageConnectionContext
isInitialDefaultSchema
in interface LanguageConnectionContext
LanguageConnectionContext.isInitialDefaultSchema(java.lang.String)
public void setDefaultSchema(SchemaDescriptor sd) throws StandardException
LanguageConnectionContext
setDefaultSchema
in interface LanguageConnectionContext
sd
- 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
LanguageConnectionContext
setDefaultSchema
in interface LanguageConnectionContext
a
- 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
LanguageConnectionContext
resetSchemaUsages
in interface LanguageConnectionContext
activation
- current activationschemaName
- the schema name occurences of which is to be resetStandardException
LanguageConnectionContext.resetSchemaUsages(Activation activation,
String schemaName)
public java.lang.Long getIdentityValue()
getIdentityValue
in interface LanguageConnectionContext
public void setIdentityValue(long val)
setIdentityValue
in interface LanguageConnectionContext
val
- the generated identity column valuepublic final CompilerContext pushCompilerContext()
pushCompilerContext
in interface LanguageConnectionContext
public CompilerContext pushCompilerContext(SchemaDescriptor sd)
pushCompilerContext
in interface LanguageConnectionContext
sd
- the default schemapublic void popCompilerContext(CompilerContext cc)
popCompilerContext
in interface LanguageConnectionContext
cc
- The compiler context.public StatementContext pushStatementContext(boolean isAtomic, boolean isForReadOnly, java.lang.String stmtText, ParameterValueSet pvs, boolean rollbackParentContext, long timeoutMillis)
pushStatementContext
in interface LanguageConnectionContext
isAtomic
- 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 LanguageConnectionContext
statementContext
- 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 LanguageConnectionContext
validator
- the validator to addpublic void popExecutionStmtValidator(ExecutionStmtValidator validator) throws StandardException
popExecutionStmtValidator
in interface LanguageConnectionContext
validator
- the validator to removeStandardException
- on errorpublic void pushTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
Multiple TriggerExecutionContexts may be active at any given time.
pushTriggerExecutionContext
in interface LanguageConnectionContext
tec
- the trigger execution contextStandardException
- on trigger recursion errorpublic void popTriggerExecutionContext(TriggerExecutionContext tec) throws StandardException
popTriggerExecutionContext
in interface LanguageConnectionContext
tec
- the tec to removeStandardException
- on errorpublic TriggerExecutionContext getTriggerExecutionContext()
getTriggerExecutionContext
in interface LanguageConnectionContext
public void validateStmtExecution(ConstantAction constantAction) throws StandardException
validateStmtExecution
in interface LanguageConnectionContext
constantAction
- the constantAction that is about to be executed (and
should be validatedStandardException
- on validation failurepublic void pushTriggerTable(TableDescriptor td)
pushTriggerTable
in interface LanguageConnectionContext
td
- the table that the trigger is
defined uponpublic void popTriggerTable(TableDescriptor td)
popTriggerTable
in interface LanguageConnectionContext
td
- the table to remove from the stack.public TableDescriptor getTriggerTable()
getTriggerTable
in interface LanguageConnectionContext
public Database getDatabase()
LanguageConnectionContext
getDatabase
in interface LanguageConnectionContext
LanguageConnectionContext.getDatabase()
public int incrementBindCount()
LanguageConnectionContext
incrementBindCount
in interface LanguageConnectionContext
LanguageConnectionContext.incrementBindCount()
public int decrementBindCount()
LanguageConnectionContext
decrementBindCount
in interface LanguageConnectionContext
LanguageConnectionContext.decrementBindCount()
public int getBindCount()
LanguageConnectionContext
getBindCount
in interface LanguageConnectionContext
LanguageConnectionContext.getBindCount()
public final void setDataDictionaryWriteMode()
LanguageConnectionContext
setDataDictionaryWriteMode
in interface LanguageConnectionContext
LanguageConnectionContext.setDataDictionaryWriteMode()
public final boolean dataDictionaryInWriteMode()
LanguageConnectionContext
dataDictionaryInWriteMode
in interface LanguageConnectionContext
LanguageConnectionContext.dataDictionaryInWriteMode()
public final void setRunTimeStatisticsMode(boolean onOrOff)
LanguageConnectionContext
setRunTimeStatisticsMode
in interface LanguageConnectionContext
LanguageConnectionContext.setRunTimeStatisticsMode(boolean)
public boolean getRunTimeStatisticsMode()
LanguageConnectionContext
getRunTimeStatisticsMode
in interface LanguageConnectionContext
LanguageConnectionContext.getRunTimeStatisticsMode()
public void setStatisticsTiming(boolean onOrOff)
LanguageConnectionContext
setStatisticsTiming
in interface LanguageConnectionContext
LanguageConnectionContext.setStatisticsTiming(boolean)
public boolean getStatisticsTiming()
LanguageConnectionContext
getStatisticsTiming
in interface LanguageConnectionContext
LanguageConnectionContext.getStatisticsTiming()
public void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
LanguageConnectionContext
setRunTimeStatisticsObject
in interface LanguageConnectionContext
LanguageConnectionContext.setRunTimeStatisticsObject(org.apache.derby.iapi.sql.execute.RunTimeStatistics)
public RunTimeStatistics getRunTimeStatisticsObject()
LanguageConnectionContext
getRunTimeStatisticsObject
in interface LanguageConnectionContext
LanguageConnectionContext.getRunTimeStatisticsObject()
public int getStatementDepth()
getStatementDepth
in interface LanguageConnectionContext
public boolean isIsolationLevelSetUsingSQLorJDBC()
LanguageConnectionContext
isIsolationLevelSetUsingSQLorJDBC
in interface LanguageConnectionContext
LanguageConnectionContext.isIsolationLevelSetUsingSQLorJDBC()
public void resetIsolationLevelFlagUsedForSQLandJDBC()
LanguageConnectionContext
resetIsolationLevelFlagUsedForSQLandJDBC
in interface LanguageConnectionContext
LanguageConnectionContext.resetIsolationLevelFlagUsedForSQLandJDBC()
public void setIsolationLevel(int isolationLevel) throws StandardException
LanguageConnectionContext
setIsolationLevel
in interface LanguageConnectionContext
isolationLevel
- The new isolationLevel.StandardException
LanguageConnectionContext.setIsolationLevel(int)
public int getCurrentIsolationLevel()
LanguageConnectionContext
getCurrentIsolationLevel
in interface LanguageConnectionContext
LanguageConnectionContext.getCurrentIsolationLevel()
public java.lang.String getCurrentIsolationLevelStr()
LanguageConnectionContext
getCurrentIsolationLevelStr
in interface LanguageConnectionContext
LanguageConnectionContext.getCurrentIsolationLevel()
public void setPrepareIsolationLevel(int level)
setPrepareIsolationLevel
in interface LanguageConnectionContext
LanguageConnectionContext.setPrepareIsolationLevel(int)
public int getPrepareIsolationLevel()
LanguageConnectionContext
getPrepareIsolationLevel
in interface LanguageConnectionContext
LanguageConnectionContext.getPrepareIsolationLevel()
public StatementContext getStatementContext()
LanguageConnectionContext
getStatementContext
in interface LanguageConnectionContext
LanguageConnectionContext.getStatementContext()
public void setOptimizerTracer(OptTrace tracer)
LanguageConnectionContext
setOptimizerTracer
in interface LanguageConnectionContext
tracer
- Null if tracing is being turned off, otherwise an optimizer tracerLanguageConnectionContext.setOptimizerTracer(org.apache.derby.iapi.sql.compile.OptTrace)
public OptTrace getOptimizerTracer()
LanguageConnectionContext
getOptimizerTracer
in interface LanguageConnectionContext
LanguageConnectionContext.getOptimizerTracer()
public boolean optimizerTracingIsOn()
LanguageConnectionContext
optimizerTracingIsOn
in interface LanguageConnectionContext
LanguageConnectionContext.optimizerTracingIsOn()
public boolean isTransactionPristine()
isTransactionPristine
in interface LanguageConnectionContext
public 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 Context
StandardException
- thrown on error. REVISIT: don't want
cleanupOnError's to throw exceptions.public boolean isLastHandler(int severity)
Context
isLastHandler
in interface Context
isLastHandler
in class ContextImpl
Context.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()
LanguageConnectionContext
getDataDictionary
in interface LanguageConnectionContext
public void setReadOnly(boolean on) throws StandardException
LanguageConnectionContext
setReadOnly
in interface LanguageConnectionContext
on
- true sets the connection to be readOnly and
false sets it to readWrite.StandardException
- The operation is disallowed.LanguageConnectionContext.setReadOnly(boolean)
public boolean isReadOnly()
LanguageConnectionContext
isReadOnly
in interface LanguageConnectionContext
LanguageConnectionContext.isReadOnly()
public Authorizer getAuthorizer()
LanguageConnectionContext
getAuthorizer
in interface LanguageConnectionContext
LanguageConnectionContext.getAuthorizer()
public java.lang.Long lastAutoincrementValue(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
lastAutoincrementValue
in interface LanguageConnectionContext
LanguageConnectionContext.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)
public void setAutoincrementUpdate(boolean flag)
LanguageConnectionContext
setAutoincrementUpdate
in interface LanguageConnectionContext
flag
- the value for autoincrementUpdate (TRUE or FALSE)LanguageConnectionContext.setAutoincrementUpdate(boolean)
public boolean getAutoincrementUpdate()
LanguageConnectionContext
getAutoincrementUpdate
in interface LanguageConnectionContext
LanguageConnectionContext.getAutoincrementUpdate()
public void autoincrementCreateCounter(java.lang.String s, java.lang.String t, java.lang.String c, java.lang.Long initialValue, long increment, int position)
LanguageConnectionContext
autoincrementCreateCounter
in interface LanguageConnectionContext
s
- 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 LanguageConnectionContext
schemaName
- tableName
- columnName
- identify the column uniquely in the system.StandardException
- on error.public void autoincrementFlushCache(UUID tableUUID) throws StandardException
autoincrementFlushCache
in interface LanguageConnectionContext
tableUUID
- 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 LanguageConnectionContext
public int getInstanceNumber()
LanguageConnectionContext
getInstanceNumber
in interface LanguageConnectionContext
LanguageConnectionContext.getInstanceNumber()
public java.lang.String getDrdaID()
LanguageConnectionContext
getDrdaID
in interface LanguageConnectionContext
LanguageConnectionContext.getDrdaID()
public void setDrdaID(java.lang.String drdaID)
LanguageConnectionContext
setDrdaID
in interface LanguageConnectionContext
drdaID
- DRDA ID.LanguageConnectionContext.setDrdaID(java.lang.String)
public java.lang.String getDbname()
LanguageConnectionContext
getDbname
in interface LanguageConnectionContext
LanguageConnectionContext.getDbname()
public Activation getLastActivation()
LanguageConnectionContext
getLastActivation
in interface LanguageConnectionContext
LanguageConnectionContext.getLastActivation()
public java.lang.StringBuffer appendErrorInfo()
appendErrorInfo
in class ContextImpl
public void setCurrentRole(Activation a, java.lang.String role)
LanguageConnectionContext
setCurrentRole
in interface LanguageConnectionContext
a
- 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)
LanguageConnectionContext
getCurrentRoleId
in interface LanguageConnectionContext
a
- activation of statement needing current roleLanguageConnectionContext.getCurrentRoleId(Activation a)
public java.lang.String getCurrentUserId(Activation a)
LanguageConnectionContext
getCurrentUserId
in interface LanguageConnectionContext
a
- activationLanguageConnectionContext.getCurrentUserId(Activation a)
public java.lang.String getCurrentRoleIdDelimited(Activation a) throws StandardException
LanguageConnectionContext
getCurrentRoleIdDelimited
in interface LanguageConnectionContext
a
- activation of statement needing current roleStandardException
- standard exception policyLanguageConnectionContext.getCurrentRoleIdDelimited(Activation a)
public boolean roleIsSettable(Activation a, java.lang.String role) throws StandardException
LanguageConnectionContext
roleIsSettable
in interface LanguageConnectionContext
a
- activationrole
- string containing role nameStandardException
- standard exception policyLanguageConnectionContext.roleIsSettable(Activation a, String role)
public SQLSessionContext getCurrentSQLSessionContext(Activation activation)
getCurrentSQLSessionContext
in interface LanguageConnectionContext
activation
- 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 LanguageConnectionContext
a
- 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
StandardException
public void popNestedSessionContext(Activation a) throws StandardException
LanguageConnectionContext
popNestedSessionContext
in interface LanguageConnectionContext
a
- activationStandardException
- standard error policyprivate void compareConstraintModes(SQLSessionContext nested, SQLSessionContext caller) throws StandardException
StandardException
public boolean isEffectivelyDeferred(SQLSessionContext sc, UUID constraintId) throws StandardException
LanguageConnectionContext
isEffectivelyDeferred
in interface LanguageConnectionContext
sc
- 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
LanguageConnectionContext
ALTER 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 LanguageConnectionContext
StandardException
LanguageConnectionContext.setupSubStatementSessionContext(Activation a)
public SQLSessionContext getTopLevelSQLSessionContext()
LanguageConnectionContext
getTopLevelSQLSessionContext
in interface LanguageConnectionContext
topLevelSSC
public SQLSessionContext createSQLSessionContext()
LanguageConnectionContext
createSQLSessionContext
in interface LanguageConnectionContext
LanguageConnectionContext.createSQLSessionContext()
public java.util.Map<java.lang.Object,java.lang.Object> getPrintedObjectsMap()
LanguageConnectionContext
getPrintedObjectsMap
in interface LanguageConnectionContext
LanguageConnectionContext.getPrintedObjectsMap()
public boolean getXplainOnlyMode()
LanguageConnectionContext
getXplainOnlyMode
in interface LanguageConnectionContext
LanguageConnectionContext.getXplainOnlyMode()
public void setXplainOnlyMode(boolean onOrOff)
LanguageConnectionContext
setXplainOnlyMode
in interface LanguageConnectionContext
onOrOff
- true if statements are to be XPLAINed only.LanguageConnectionContext.setXplainOnlyMode(boolean)
public java.lang.String getXplainSchema()
LanguageConnectionContext
getXplainSchema
in interface LanguageConnectionContext
LanguageConnectionContext.getXplainSchema()
public void setXplainSchema(java.lang.String s)
LanguageConnectionContext
setXplainSchema
in interface LanguageConnectionContext
s
- 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 LanguageConnectionContext
public java.lang.Object getXplainStatement(java.lang.Object key)
getXplainStatement
in interface LanguageConnectionContext
public void setASTVisitor(ASTVisitor visitor)
LanguageConnectionContext
setASTVisitor
in interface LanguageConnectionContext
visitor
- The Visitor which should walk the tree. Could be null.public ASTVisitor getASTVisitor()
LanguageConnectionContext
getASTVisitor
in interface LanguageConnectionContext
public void setInterruptedException(StandardException e)
LanguageConnectionContext
setInterruptedException
in interface LanguageConnectionContext
e
- the created exceptionpublic StandardException getInterruptedException()
LanguageConnectionContext
getInterruptedException
in interface LanguageConnectionContext
public FormatableBitSet getReferencedColumnMap(TableDescriptor td)
LanguageConnectionContext
getReferencedColumnMap
in interface LanguageConnectionContext
public void setReferencedColumnMap(TableDescriptor td, FormatableBitSet map)
LanguageConnectionContext
setReferencedColumnMap
in interface LanguageConnectionContext
td
- the table descriptormap
- the mappublic void setConstraintDeferred(Activation a, ConstraintDescriptor cd, boolean deferred) throws StandardException
setConstraintDeferred
in interface LanguageConnectionContext
a
- activationcd
- the constraint descriptordeferred
- the constraint modeStandardException
- standard error policypublic void checkIntegrity() throws StandardException
LanguageConnectionContext
checkIntegrity
in interface LanguageConnectionContext
StandardException
private void clearDeferreds()
public void setDeferredAll(Activation a, boolean deferred) throws StandardException
LanguageConnectionContext
deferred
. 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 LanguageConnectionContext
a
- The activationdeferred
- The value which holds the constraint modeStandardException
- Standard error policypublic java.util.HashMap<UUID,DeferredConstraintsMemory.ValidationInfo> getDeferredHashTables()
LanguageConnectionContext
getDeferredHashTables
in interface LanguageConnectionContext
private void validateDeferredConstraints(boolean rollbackOnError) throws StandardException
StandardException
private void validateDeferredConstraint(ConstraintDescriptor cd) throws StandardException
cd
- the descriptor of the constraint to validateStandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.