|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.derby.iapi.services.context.ContextImpl
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext
LanguageConnectionContext keeps the pool of prepared statements, activations, and cursors in use by the current connection.
The generic impl does not provide statement caching.
| Field Summary | |
private java.util.Vector |
acts
|
protected AccessFactory |
af
|
private java.util.ArrayList |
allDeclaredGlobalTempTables
|
protected Authorizer |
authorizer
|
private java.util.Hashtable |
autoincrementCacheHashtable
|
private java.util.Hashtable |
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
|
protected TransactionController |
childTransaction
If non-null indicates that a nested user transaction is in progress. |
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.lang.String |
drdaID
|
private int |
identifierCasing
|
private boolean |
identityNotNull
|
private long |
identityVal
|
private int |
instanceNumber
|
protected int |
isolationLevel
|
private boolean |
isolationLevelExplicitlySet
|
private HeaderPrintWriter |
istream
|
protected LanguageFactory |
langFactory
|
private java.lang.String |
lastOptimizerTraceOutput
|
private int |
lockEscalationThreshold
|
private boolean |
logQueryPlan
|
private boolean |
logStatementText
|
protected long |
nextCursorId
|
protected int |
nextSavepointId
|
private static int |
NON_XA
|
protected OptimizerFactory |
of
|
private boolean |
optimizerTrace
|
private boolean |
optimizerTraceHtml
|
private java.lang.String |
optimizerTraceOutput
|
protected int |
outermostTrigger
|
protected int |
prepareIsolationLevel
|
protected int |
queryNestingDepth
queryNestingDepth is a counter used to keep track of how many calls have been made to begin nested transactions. |
private RunTimeStatistics |
runTimeStatisticsObject
|
private boolean |
runTimeStatisticsSetting
|
private java.lang.StringBuffer |
sb
|
protected SchemaDescriptor |
sd
|
CacheManager |
statementCache
|
protected StatementContext[] |
statementContexts
|
protected int |
statementDepth
|
private boolean |
statisticsTiming
|
private java.util.Vector |
stmtValidators
|
protected TypeCompilerFactory |
tcf
|
protected TransactionController |
tran
The transaction to use within this language connection context. |
private java.util.Vector |
triggerExecutionContexts
|
private java.util.Vector |
triggerTables
|
protected java.lang.String |
userName
|
private static int |
XA_ONE_PHASE
|
private static int |
XA_TWO_PHASE
|
| Fields inherited from class org.apache.derby.iapi.services.context.ContextImpl |
|
| Fields inherited from interface org.apache.derby.iapi.sql.conn.LanguageConnectionContext |
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 Summary | |
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)
|
|
| Method Summary | |
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. |
boolean |
anyoneBlocked()
Return true if any transaction is blocked, even if not by this one |
java.lang.StringBuffer |
appendErrorInfo()
|
void |
appendOptimizerTraceOutput(java.lang.String output)
Append the latest output to the optimizer trace output. |
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 |
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. |
void |
commitNestedTransaction()
commit a nested transaction. |
java.lang.String |
convertIdentifierCase(java.lang.String id)
Convert an identifier to the proper case for this connection. |
void |
copyHashtableToAIHT(java.util.Hashtable from)
Copies an existing hashtable of autoincrement mappings into autoincrementHT, the cache of autoincrement values kept in the languageconnectioncontext. |
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. |
void |
emptyCache()
Empty as much of the cache as possible. |
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. |
AccessFactory |
getAccessFactory()
Get the AccessFactory cached in this LanguageConnectionContext |
int |
getActivationCount()
Return the number of activations known for this connection. |
java.lang.String |
getAuthorizationId()
Get the Authorization Id |
protected java.lang.String |
getAuthorizationId(java.lang.String userName)
Set the authorization identifier for this user. |
Authorizer |
getAuthorizer()
Get an Authorizer for this connection. |
boolean |
getAutoincrementUpdate()
Returns the current value of autoincrementUpdate. |
int |
getBindCount()
Get the DataDictionary bind count. |
int |
getCacheSize()
|
int |
getCurrentIsolationLevel()
Get the current isolation level. |
java.lang.String |
getCurrentIsolationLevelStr()
Get the current isolation level in DB2 format. |
java.lang.String |
getCurrentSchemaName()
Get the current schema name |
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. |
java.lang.String |
getDeclaredGlobalTemporaryTablesSchemaName()
Get the declared global temporary tables schema name. |
SchemaDescriptor |
getDefaultSchema()
Get the default schema |
java.lang.String |
getDrdaID()
Get the DRDA ID of this LCC. |
ExecutionContext |
getExecutionContext()
Get the current ExecutionContext. |
int |
getIdentifierCasing()
Get casing for delimited identifiers. |
java.lang.Long |
getIdentityValue()
Get the identity column value most recently generated. |
int |
getInstanceNumber()
Get the instance number of this LCC. |
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 |
int |
getLockEscalationThreshold()
get the lock escalation threshold. |
java.lang.Object |
getLockObject(int lockScope)
Get the lock handle for the current transaction. |
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. |
boolean |
getOptimizerTrace()
Get whether or not optimizer trace is on. |
boolean |
getOptimizerTraceHtml()
Get whether or not optimizer trace html is on. |
java.lang.String |
getOptimizerTraceOutput()
Get the optimizer trace output for the last optimized query as a String. |
int |
getPrepareIsolationLevel()
Get the prepare isolation level. |
boolean |
getRunTimeStatisticsMode()
Get the RUNTIMESTATISTICS mode. |
RunTimeStatistics |
getRunTimeStatisticsObject()
Get the RUNTIMESTATISTICS object. |
StatementContext |
getStatementContext()
Get the current StatementContext. |
int |
getStatementDepth()
Reports how many statement levels deep we are. |
boolean |
getStatisticsTiming()
Get the STATISTICS TIMING mode. |
java.lang.String |
getSysIBMSchemaName()
Get the name of the SYSIBM schema. |
java.lang.String |
getSystemDiagSchemaName()
Get the name of the SYSCS_DIAG schema. |
java.lang.String |
getSystemSchemaName()
Get the name of the system schema. |
java.lang.String |
getSystemUtilSchemaName()
Get the name of the SYSCS_UTIL schema. |
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. |
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. |
int |
incrementBindCount()
Increment the DataDictionary bind count. |
private void |
incrementStatementDepth()
Increments the statement depth. |
protected SchemaDescriptor |
initDefaultSchemaDescriptor()
|
void |
initialize(boolean sqlConnection)
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 |
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)
Implements ConnectionInfo.lastAutoincrementValue. |
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 |
popCompilerContext(CompilerContext cc)
Pop a CompilerContext off the context stack. |
void |
popExecutionStmtValidator(ExecutionStmtValidator validator)
Remove the validator. |
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)
|
PreparedStatement |
prepareInternalStatement(java.lang.String sqlText)
Return a Statement object to compile a Statement. |
CompilerContext |
pushCompilerContext()
Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against. |
CompilerContext |
pushCompilerContext(SchemaDescriptor sd)
Push a CompilerContext on the context stack with the passed in default schema as the default schema we compile against. |
void |
pushExecutionStmtValidator(ExecutionStmtValidator validator)
Push a new execution statement validator. |
StatementContext |
pushStatementContext(boolean isAtomic,
java.lang.String stmtText,
ParameterValueSet pvs,
boolean rollbackParentContext)
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(Statement 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. |
private void |
resetActivations(boolean andClose)
resets all open activations, to close their result sets. |
void |
resetFromPool()
Reset the connection before it is returned (indirectly) by a PooledConnection object. |
private void |
resetSavepoints(StatementContext statementContext)
|
protected void |
resetStatementDepth()
Resets the statementDepth. |
void |
setAutoincrementUpdate(boolean flag)
Sets autoincrementUpdate-- this variable allows updates to autoincrement columns if it is set to true. |
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(SchemaDescriptor sd)
Set the default schema -- used by SET SCHEMA. |
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 |
setIsolationLevel(int isolationLevel)
Set current isolation level. |
void |
setLogStatementText(boolean logStatementText)
Set value of logStatementText (Whether or not to write info on currently executing statement to error log.) |
boolean |
setOptimizerTrace(boolean onOrOff)
Control whether or not optimizer trace is on. |
boolean |
setOptimizerTraceHtml(boolean onOrOff)
Control whether or not optimizer trace is generated in html. |
void |
setOptimizerTraceOutput(java.lang.String startingText)
Set the optimizer trace output to the specified String. |
void |
setPrepareIsolationLevel(int level)
|
void |
setReadOnly(boolean on)
Set the readOnly status for the current connection. |
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. |
void |
setTransaction(TransactionController tran)
Sets the transaction controller to use with this language connection context. |
private void |
tempTablesAndCommit()
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 |
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. |
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. |
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. |
| Methods inherited from class org.apache.derby.iapi.services.context.ContextImpl |
getContextManager, getIdName, popMe, pushMe |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.derby.iapi.services.context.Context |
getContextManager, getIdName, popMe, pushMe |
| Field Detail |
private static final int NON_XA
private static final int XA_ONE_PHASE
private static final int XA_TWO_PHASE
private final java.util.Vector acts
protected int bindCount
private boolean ddWriteMode
private boolean runTimeStatisticsSetting
private boolean statisticsTiming
private java.util.ArrayList 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 int identifierCasing
protected TransactionController tran
protected TransactionController childTransaction
protected int queryNestingDepth
protected DataValueFactory dataFactory
protected LanguageFactory langFactory
protected TypeCompilerFactory tcf
protected OptimizerFactory of
protected LanguageConnectionFactory connFactory
protected StatementContext[] statementContexts
protected int statementDepth
protected int outermostTrigger
protected Authorizer authorizer
protected java.lang.String userName
protected SchemaDescriptor sd
private int defaultIsolationLevel
protected int isolationLevel
private boolean isolationLevelExplicitlySet
protected int prepareIsolationLevel
private boolean logStatementText
private boolean logQueryPlan
private HeaderPrintWriter istream
private int lockEscalationThreshold
private java.util.Vector stmtValidators
private java.util.Vector triggerExecutionContexts
private java.util.Vector triggerTables
protected AccessFactory af
private boolean optimizerTrace
private boolean optimizerTraceHtml
private java.lang.String lastOptimizerTraceOutput
private java.lang.String optimizerTraceOutput
private java.util.Hashtable autoincrementHT
private boolean autoincrementUpdate
private long identityVal
private boolean identityNotNull
private java.util.Hashtable autoincrementCacheHashtable
public CacheManager statementCache
| Constructor Detail |
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
| Method Detail |
public void initialize(boolean sqlConnection)
throws StandardException
LanguageConnectionContext
initialize in interface LanguageConnectionContextsqlConnection - Whether or not this is called from a sql connection.
StandardException - thrown if something goes wrong
protected SchemaDescriptor initDefaultSchemaDescriptor()
throws StandardException
StandardExceptionpublic boolean getLogStatementText()
LanguageConnectionContext
getLogStatementText in interface LanguageConnectionContextLanguageConnectionContext.getLogStatementText()public void setLogStatementText(boolean logStatementText)
LanguageConnectionContext
setLogStatementText in interface LanguageConnectionContextlogStatementText - Whether or not logStatementText property is set.
LanguageConnectionContext.setLogStatementText(boolean)public boolean getLogQueryPlan()
LanguageConnectionContext
getLogQueryPlan in interface LanguageConnectionContextLanguageConnectionContext.getLogQueryPlan()public int getLockEscalationThreshold()
getLockEscalationThreshold in interface LanguageConnectionContextpublic int getCacheSize()
public void addActivation(Activation a)
addActivation in interface LanguageConnectionContextpublic boolean checkIfAnyDeclaredGlobalTempTablesForThisConnection()
LanguageConnectionContext
checkIfAnyDeclaredGlobalTempTablesForThisConnection in interface LanguageConnectionContextLanguageConnectionContext.checkIfAnyDeclaredGlobalTempTablesForThisConnection()
public void addDeclaredGlobalTempTable(TableDescriptor td)
throws StandardException
LanguageConnectionContext
addDeclaredGlobalTempTable in interface LanguageConnectionContextStandardExceptionLanguageConnectionContext.addDeclaredGlobalTempTable(org.apache.derby.iapi.sql.dictionary.TableDescriptor)public boolean dropDeclaredGlobalTempTable(java.lang.String tableName)
LanguageConnectionContext
dropDeclaredGlobalTempTable in interface LanguageConnectionContextLanguageConnectionContext.dropDeclaredGlobalTempTable(java.lang.String)private void tempTablesReleaseSavepointLevels()
private void tempTablesAndCommit()
public void resetFromPool()
throws StandardException
resetFromPool in interface LanguageConnectionContextStandardException
private void dropAllDeclaredGlobalTempTables()
throws StandardException
StandardException
private void tempTablesAndRollback()
throws StandardException
StandardException
private void replaceDeclaredGlobalTempTable(java.lang.String tableName,
TableDescriptor td)
public TableDescriptor getTableDescriptorForDeclaredGlobalTempTable(java.lang.String tableName)
LanguageConnectionContext
getTableDescriptorForDeclaredGlobalTempTable in interface LanguageConnectionContextLanguageConnectionContext.getTableDescriptorForDeclaredGlobalTempTable(java.lang.String)private TempTableInfo findDeclaredGlobalTempTable(java.lang.String tableName)
public void markTempTableAsModifiedInUnitOfWork(java.lang.String tableName)
LanguageConnectionContext
markTempTableAsModifiedInUnitOfWork in interface LanguageConnectionContextLanguageConnectionContext.markTempTableAsModifiedInUnitOfWork(java.lang.String)
public PreparedStatement prepareInternalStatement(java.lang.String sqlText)
throws StandardException
prepareInternalStatement in interface LanguageConnectionContextStandardException
public PreparedStatement prepareInternalStatement(SchemaDescriptor compilationSchema,
java.lang.String sqlText)
throws StandardException
prepareInternalStatement in interface LanguageConnectionContextStandardExceptionpublic void removeActivation(Activation a)
removeActivation in interface LanguageConnectionContextpublic int getActivationCount()
getActivationCount in interface LanguageConnectionContextpublic CursorActivation lookupCursorActivation(java.lang.String cursorName)
lookupCursorActivation in interface LanguageConnectionContext
public void removeStatement(Statement statement)
throws StandardException
statement - Statement to remove
StandardException - 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 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 uniqueness
public void internalCommit(boolean commitStore)
throws StandardException
internalCommit in interface LanguageConnectionContextcommitStore - true if we should commit the Store transaction
StandardException - thrown on failure
public void userCommit()
throws StandardException
userCommit in interface LanguageConnectionContextStandardException - thrown on failure
public 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
TransactionController
StandardException - thrown on failure
public 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 wrong
protected 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 error
private 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 LanguageConnectionContextStandardException - thrown on failure
public void userRollback()
throws StandardException
userRollback in interface LanguageConnectionContextStandardException - thrown on failure
public void xaRollback()
throws StandardException
xaRollback in interface LanguageConnectionContextStandardException - thrown if something goes wrong
private 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 user
StandardException - thrown on failure
private void resetSavepoints(StatementContext statementContext)
throws StandardException
StandardException
public 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 savepoint
StandardException - thrown if something goes wrong
public 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 savepoint
StandardException - thrown if something goes wrong
public 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 savepoint
StandardException - thrown if something goes wrongpublic boolean anyoneBlocked()
anyoneBlocked in interface LanguageConnectionContextpublic void setTransaction(TransactionController tran)
setTransaction in interface LanguageConnectionContexttran - the transaction to use with this language connection context
public void beginNestedTransaction(boolean readOnly)
throws StandardException
beginNestedTransaction in interface LanguageConnectionContextreadOnly - The nested transaction would be read only if param value true
StandardException - on error.TransactionController.startNestedUserTransaction(boolean)
public void commitNestedTransaction()
throws StandardException
LanguageConnectionContext
commitNestedTransaction in interface LanguageConnectionContextStandardException - thrown on erroTransactionController.startNestedUserTransaction(boolean)public TransactionController getTransactionCompile()
getTransactionCompile in interface LanguageConnectionContextpublic TransactionController getTransactionExecute()
LanguageConnectionContext
getTransactionExecute in interface LanguageConnectionContextpublic DataValueFactory getDataValueFactory()
getDataValueFactory in interface LanguageConnectionContextpublic LanguageFactory getLanguageFactory()
getLanguageFactory in interface LanguageConnectionContextpublic OptimizerFactory getOptimizerFactory()
LanguageConnectionContext
getOptimizerFactory in interface LanguageConnectionContextpublic LanguageConnectionFactory getLanguageConnectionFactory()
getLanguageConnectionFactory in interface LanguageConnectionContext
private boolean checkIfAnyActivationHasHoldCursor(java.lang.String tableName)
throws StandardException
StandardException
public boolean verifyAllHeldResultSetsAreClosed()
throws StandardException
verifyAllHeldResultSetsAreClosed in interface LanguageConnectionContextStandardException - thrown on failure
public 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 invalidation
StandardException - thrown on failurepublic java.lang.String getAuthorizationId()
getAuthorizationId in interface LanguageConnectionContextpublic SchemaDescriptor getDefaultSchema()
getDefaultSchema in interface LanguageConnectionContextpublic java.lang.String getCurrentSchemaName()
getCurrentSchemaName in interface LanguageConnectionContext
public void setDefaultSchema(SchemaDescriptor sd)
throws StandardException
setDefaultSchema in interface LanguageConnectionContextStandardException - thrown on failurepublic java.lang.Long getIdentityValue()
getIdentityValue in interface LanguageConnectionContextpublic void setIdentityValue(long val)
setIdentityValue in interface LanguageConnectionContextpublic void emptyCache()
public final CompilerContext pushCompilerContext()
pushCompilerContext in interface LanguageConnectionContextStandardException - thrown on failurepublic CompilerContext pushCompilerContext(SchemaDescriptor sd)
pushCompilerContext in interface LanguageConnectionContextsd - the default schema
public void popCompilerContext(CompilerContext cc)
popCompilerContext in interface LanguageConnectionContextcc - The compiler context.
public StatementContext pushStatementContext(boolean isAtomic,
java.lang.String stmtText,
ParameterValueSet pvs,
boolean rollbackParentContext)
pushStatementContext in interface LanguageConnectionContextisAtomic - whether this statement is atomic or notstmtText - 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.
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 add
public void popExecutionStmtValidator(ExecutionStmtValidator validator)
throws StandardException
popExecutionStmtValidator in interface LanguageConnectionContextvalidator - the validator to remove
StandardException - on error
public void pushTriggerExecutionContext(TriggerExecutionContext tec)
throws StandardException
Multiple TriggerExecutionContexts may be active at any given time.
pushTriggerExecutionContext in interface LanguageConnectionContexttec - the trigger execution context
StandardException - on trigger recursion error
public void popTriggerExecutionContext(TriggerExecutionContext tec)
throws StandardException
popTriggerExecutionContext in interface LanguageConnectionContexttec - the tec to remove
StandardException - on errorpublic TriggerExecutionContext getTriggerExecutionContext()
getTriggerExecutionContext in interface LanguageConnectionContext
public void validateStmtExecution(ConstantAction constantAction)
throws StandardException
validateStmtExecution in interface LanguageConnectionContextconstantAction - the constantAction that is about to be executed (and
should be validated
StandardException - 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()
LanguageConnectionContext
getDatabase in interface LanguageConnectionContextLanguageConnectionContext.getDatabase()public int incrementBindCount()
LanguageConnectionContext
incrementBindCount in interface LanguageConnectionContextLanguageConnectionContext.incrementBindCount()public int decrementBindCount()
LanguageConnectionContext
decrementBindCount in interface LanguageConnectionContextLanguageConnectionContext.decrementBindCount()public int getBindCount()
LanguageConnectionContext
getBindCount in interface LanguageConnectionContextLanguageConnectionContext.getBindCount()public final void setDataDictionaryWriteMode()
LanguageConnectionContext
setDataDictionaryWriteMode in interface LanguageConnectionContextLanguageConnectionContext.setDataDictionaryWriteMode()public final boolean dataDictionaryInWriteMode()
LanguageConnectionContext
dataDictionaryInWriteMode in interface LanguageConnectionContextLanguageConnectionContext.dataDictionaryInWriteMode()public void setRunTimeStatisticsMode(boolean onOrOff)
LanguageConnectionContext
setRunTimeStatisticsMode in interface LanguageConnectionContextLanguageConnectionContext.setRunTimeStatisticsMode(boolean)public boolean getRunTimeStatisticsMode()
LanguageConnectionContext
getRunTimeStatisticsMode in interface LanguageConnectionContextLanguageConnectionContext.getRunTimeStatisticsMode()public void setStatisticsTiming(boolean onOrOff)
LanguageConnectionContext
setStatisticsTiming in interface LanguageConnectionContextLanguageConnectionContext.setStatisticsTiming(boolean)public boolean getStatisticsTiming()
LanguageConnectionContext
getStatisticsTiming in interface LanguageConnectionContextLanguageConnectionContext.getStatisticsTiming()public void setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)
LanguageConnectionContext
setRunTimeStatisticsObject in interface LanguageConnectionContextLanguageConnectionContext.setRunTimeStatisticsObject(org.apache.derby.iapi.sql.execute.RunTimeStatistics)public RunTimeStatistics getRunTimeStatisticsObject()
LanguageConnectionContext
getRunTimeStatisticsObject in interface LanguageConnectionContextLanguageConnectionContext.getRunTimeStatisticsObject()public int getStatementDepth()
getStatementDepth in interface LanguageConnectionContext
public void setIsolationLevel(int isolationLevel)
throws StandardException
LanguageConnectionContext
setIsolationLevel in interface LanguageConnectionContextisolationLevel - The new isolationLevel.
StandardExceptionLanguageConnectionContext.setIsolationLevel(int)public int getCurrentIsolationLevel()
LanguageConnectionContext
getCurrentIsolationLevel in interface LanguageConnectionContextLanguageConnectionContext.getCurrentIsolationLevel()public java.lang.String getCurrentIsolationLevelStr()
LanguageConnectionContext
getCurrentIsolationLevelStr in interface LanguageConnectionContextLanguageConnectionContext.getCurrentIsolationLevel()public void setPrepareIsolationLevel(int level)
setPrepareIsolationLevel in interface LanguageConnectionContextLanguageConnectionContext.setPrepareIsolationLevel(int)public int getPrepareIsolationLevel()
LanguageConnectionContext
getPrepareIsolationLevel in interface LanguageConnectionContextLanguageConnectionContext.getPrepareIsolationLevel()public ExecutionContext getExecutionContext()
LanguageConnectionContext
getExecutionContext in interface LanguageConnectionContextLanguageConnectionContext.getExecutionContext()public StatementContext getStatementContext()
LanguageConnectionContext
getStatementContext in interface LanguageConnectionContextLanguageConnectionContext.getStatementContext()public boolean setOptimizerTrace(boolean onOrOff)
LanguageConnectionContext
setOptimizerTrace in interface LanguageConnectionContextonOrOff - Whether to turn optimizer trace on (true) or off (false).
LanguageConnectionContext.setOptimizerTrace(boolean)public boolean getOptimizerTrace()
LanguageConnectionContext
getOptimizerTrace in interface LanguageConnectionContextLanguageConnectionContext.getOptimizerTrace()public boolean setOptimizerTraceHtml(boolean onOrOff)
LanguageConnectionContext
setOptimizerTraceHtml in interface LanguageConnectionContextonOrOff - Whether or not optimizer trace will be in html (true) or not (false).
LanguageConnectionContext.setOptimizerTraceHtml(boolean)public boolean getOptimizerTraceHtml()
LanguageConnectionContext
getOptimizerTraceHtml in interface LanguageConnectionContextLanguageConnectionContext.getOptimizerTraceHtml()public void setOptimizerTraceOutput(java.lang.String startingText)
LanguageConnectionContext
setOptimizerTraceOutput in interface LanguageConnectionContextLanguageConnectionContext.setOptimizerTraceOutput(java.lang.String)public void appendOptimizerTraceOutput(java.lang.String output)
LanguageConnectionContext
appendOptimizerTraceOutput in interface LanguageConnectionContextLanguageConnectionContext.appendOptimizerTraceOutput(java.lang.String)public java.lang.String getOptimizerTraceOutput()
LanguageConnectionContext
getOptimizerTraceOutput in interface LanguageConnectionContextLanguageConnectionContext.getOptimizerTraceOutput()public boolean isTransactionPristine()
isTransactionPristine in interface LanguageConnectionContext
public java.lang.Object getLockObject(int lockScope)
throws StandardException
getLockObject in interface LanguageConnectionContextlockScope - SINGLE_TRANSACTION_LOCK or MULTI_TRANSACTION_LOCK
StandardException - thrown if something goes wrong
public java.lang.String convertIdentifierCase(java.lang.String id)
throws StandardException
convertIdentifierCase in interface LanguageConnectionContextStandardException - thrown if something goes wrong
public int getIdentifierCasing()
throws StandardException
getIdentifierCasing in interface LanguageConnectionContextStandardException - thrown if something goes wrong
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 ContextStandardException - thrown on error. REVISIT: don't want
cleanupOnError's to throw exceptions.public boolean isLastHandler(int severity)
Context
isLastHandler in interface ContextisLastHandler in class ContextImplContext.isLastHandler(int)
private void resetActivations(boolean andClose)
throws StandardException
StandardException - thrown on failure
private void finishDDTransaction()
throws StandardException
StandardException - Thrown on errorprivate void incrementStatementDepth()
private void decrementStatementDepth()
protected void resetStatementDepth()
public java.lang.String getSystemSchemaName()
throws StandardException
getSystemSchemaName in interface LanguageConnectionContextStandardException
public java.lang.String getSysIBMSchemaName()
throws StandardException
getSysIBMSchemaName in interface LanguageConnectionContextStandardException
public java.lang.String getSystemDiagSchemaName()
throws StandardException
getSystemDiagSchemaName in interface LanguageConnectionContextStandardException
public java.lang.String getSystemUtilSchemaName()
throws StandardException
getSystemUtilSchemaName in interface LanguageConnectionContextStandardException
public java.lang.String getDeclaredGlobalTemporaryTablesSchemaName()
throws StandardException
getDeclaredGlobalTemporaryTablesSchemaName in interface LanguageConnectionContextStandardExceptionpublic DataDictionary getDataDictionary()
LanguageConnectionContext
getDataDictionary in interface LanguageConnectionContext
public void setReadOnly(boolean on)
throws StandardException
LanguageConnectionContext
setReadOnly 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()
LanguageConnectionContext
isReadOnly in interface LanguageConnectionContextLanguageConnectionContext.isReadOnly()public Authorizer getAuthorizer()
LanguageConnectionContext
getAuthorizer in interface LanguageConnectionContextLanguageConnectionContext.getAuthorizer()public AccessFactory getAccessFactory()
LanguageConnectionContext
getAccessFactory in interface LanguageConnectionContextLanguageConnectionContext.getAccessFactory()
public java.lang.Long lastAutoincrementValue(java.lang.String schemaName,
java.lang.String tableName,
java.lang.String columnName)
lastAutoincrementValue in interface LanguageConnectionContextschemaName - tableName - columnName - LanguageConnectionContext.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String),
ConnectionInfo.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)public void setAutoincrementUpdate(boolean flag)
LanguageConnectionContext
setAutoincrementUpdate in interface LanguageConnectionContextflag - the value for autoincrementUpdate (TRUE or FALSE)LanguageConnectionContext.setAutoincrementUpdate(boolean)public boolean getAutoincrementUpdate()
LanguageConnectionContext
getAutoincrementUpdate 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)
LanguageConnectionContext
autoincrementCreateCounter 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),
ConnectionInfo.lastAutoincrementValue(java.lang.String, java.lang.String, java.lang.String)public void copyHashtableToAIHT(java.util.Hashtable from)
copyHashtableToAIHT in interface LanguageConnectionContextpublic int getInstanceNumber()
LanguageConnectionContext
getInstanceNumber in interface LanguageConnectionContextLanguageConnectionContext.getInstanceNumber()public java.lang.String getDrdaID()
LanguageConnectionContext
getDrdaID in interface LanguageConnectionContextLanguageConnectionContext.getDrdaID()public void setDrdaID(java.lang.String drdaID)
LanguageConnectionContext
setDrdaID in interface LanguageConnectionContextLanguageConnectionContext.setDrdaID(java.lang.String)public java.lang.String getDbname()
LanguageConnectionContext
getDbname in interface LanguageConnectionContextLanguageConnectionContext.getDbname()public Activation getLastActivation()
LanguageConnectionContext
getLastActivation in interface LanguageConnectionContextLanguageConnectionContext.getLastActivation()
protected java.lang.String getAuthorizationId(java.lang.String userName)
throws StandardException
StandardExceptionpublic java.lang.StringBuffer appendErrorInfo()
appendErrorInfo in class ContextImpl
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||