Top Description Fields Methods
org.apache.derby.iapi.sql.conn

public Interface LanguageConnectionContext

extends Context
Known Direct Implementers
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext
Imports
java.util.HashMap, .Map, org.apache.derby.catalog.UUID, org.apache.derby.iapi.db.Database, .TriggerExecutionContext, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.context.Context, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.sql.Activation, .LanguageFactory, .ParameterValueSet, .PreparedStatement, org.apache.derby.iapi.sql.compile.ASTVisitor, .CompilerContext, .OptTrace, .OptimizerFactory, org.apache.derby.iapi.sql.depend.Provider, org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor, .DataDictionary, .SchemaDescriptor, .TableDescriptor, org.apache.derby.iapi.sql.execute.ConstantAction, .CursorActivation, .ExecutionStmtValidator, .RunTimeStatistics, org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.types.DataValueFactory, org.apache.derby.impl.sql.execute.DeferredConstraintsMemory

LanguageConnectionContext keeps the result sets, and activations in use by the current connection.

More stable items, like other factories, are accessible through the LanguageConnectionFactory or the LanguageFactory.

See Also
LanguageConnectionFactory, org.apache.derby.iapi.sql.LanguageFactory

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final String
CONTEXT_ID

this is the ID we expect these contexts to be stored into a context manager under.

public static final String
public static final String
public static final String
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final String

Method Summary

Modifier and TypeMethod and Description
public void
addActivation(Activation a)

Add the activation to those known about by this connection.

public void
addDeclaredGlobalTempTable(TableDescriptor
Corresponding to the temporary table
td
)

Add the declared global temporary table to the list of temporary tables known by this connection.

public void
autoincrementCreateCounter(String
SchemaName
s
,
String
TableName
t
,
String
ColumnName
c
,
Long
initial value of the counter.
initialValue
,
long
increment for the counter.
increment
,
int
column position (1-based).
position
)

Create an autoincrement counter to be used on behalf of a SQL-J statement.

public void
autoincrementFlushCache(UUID
the table which is being flushed; we need this value to identify the table for which the autoincrement counter is being maintained.
tableUUID
)

Flush the cache of autoincrement values being kept by the lcc.

public void
beginNestedTransaction(boolean
The nested transaction would be read only if param value true
readOnly
)

Begin a nested transaction.

public boolean

Returns:

true if there are declared temp tables for this connectoin else false
checkIfAnyDeclaredGlobalTempTablesForThisConnection
()

Check if there are any global temporary tables declared for this connection.

public void
checkIntegrity()

Check that deferred constraints are valid, if not roll back the transaction.

public void
closeUnusedActivations()

Close any unused activations in this connection context.

public void
commitNestedTransaction()

commit a nested transaction.

public void
copyHashtableToAIHT(Map<String, Long> from)

Copy a map of autoincrement key value pairs into the cache of ai values stored in the language connection context.

public SQLSessionContext

Returns:

new SQLSessionContext
createSQLSessionContext
()

Create a fresh SQLSessionContext for this connection.

public 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().

public int

Returns:

The new bind count
decrementBindCount
()

Decrement the DataDictionary bind count.

public boolean

Returns:

true if dropped the temporary table. False if no such temporary table exists.
dropDeclaredGlobalTempTable
(String
look for this table name in the saved list and drop it if found
tableName
)

Drop (mark the declared global temporary table for dropping) from the list of temporary tables known by this connection.

public int
getActivationCount()

Return the number of activation known for this connection.

public ASTVisitor

Returns:

The Visitor for that phase. Could be null.
getASTVisitor
()

Get the Visitor which should walk the AST.

public Authorizer
getAuthorizer()

Get an Authorizer for this connection.

public boolean

Returns:

true if updates to autoincrement columns is permitted.
getAutoincrementUpdate
()

Returns the current value of autoincrementUpdate.

public int

Returns:

The current bind count.
getBindCount
()

Get the DataDictionary bind count.

public int

Returns:

The current isolation level.
getCurrentIsolationLevel
()

Get the current isolation level.

public String

Returns:

The current isolation level as a 2 character string.
getCurrentIsolationLevelStr
()

Get the current isolation level in DB2 format.

public String

Returns:

String the role id
getCurrentRoleId
(Activation
activation of statement needing current role
a
)

Get the current role authorization identifier of the dynamic call context associated with this activation.

public String

Returns:

String the role id in delimited form (i.e. not internal case normal form)
getCurrentRoleIdDelimited
(Activation
activation of statement needing current role
a
)

Get the current role authorization identifier in external delimited form (not case normal form) of the dynamic call context associated with this activation.

public String

Returns:

SchemaDescriptor the current schema
getCurrentSchemaName
()

Get the current schema name (at compile-time, see explanations for getDefaultSchema overloads).

public String

Returns:

SchemaDescriptor the current schema
getCurrentSchemaName
(Activation a)

Get the current schema name (at execution time, see explanations for getDefaultSchema overloads); This version is used by CURRENT SCHEMA.

public SQLSessionContext

Returns:

The SQL session object
getCurrentSQLSessionContext
(Activation
The activation
activation
)

Get the SQL session context of the given activation.

public String

Returns:

String the authorization id
getCurrentUserId
(Activation
activation
a
)

Get the Authorization Id of the current user

public Database
getDatabase()

Returns the Database of this connection.

public DataDictionary

Returns:

the data dictionary
getDataDictionary
()

Get the data dictionary

public DataValueFactory
getDataValueFactory()

Get the data value factory to use with this language connection context.

public String

Returns:

database name of this LCC.
getDbname
()

Get the database name of this LCC.

public SchemaDescriptor

Returns:

SchemaDescriptor the default schema
getDefaultSchema
()

Get the default schema (used at compile-time when no activation is yet available, cf. the activation argument overload version.

public SchemaDescriptor

Returns:

SchemaDescriptor the default schema
getDefaultSchema
(Activation
current activation
a
)

Get the default schema (used at execution time).

public HashMap<UUID, DeferredConstraintsMemory.ValidationInfo>

Returns:

the set
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.

public String

Returns:

DRDA ID this LCC.
getDrdaID
()

Get the DRDA ID of this LCC.

public Long

Returns:

the generated identity column value
getIdentityValue
()

Get the identity column value most recently generated.

public int

Returns:

instance number of this LCC.
getInstanceNumber
()

Get the instance number of this LCC.

public StandardException

Returns:

saved exception
getInterruptedException
()

Get exception created when we detected interruped status flag.

public LanguageConnectionFactory
getLanguageConnectionFactory()

Get the language connection factory to use with this language connection context.

public LanguageFactory
getLanguageFactory()

Get the language factory to use with this language connection context.

public 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

public Object
getLastQueryTree()

Debug method for retrieving the last query tree.

public int
getLockEscalationThreshold()

get the lock escalation threshold to use with this connection.

public boolean

Returns:

value of logQueryPlan
getLogQueryPlan
()

Get value of logQueryPlan.

public boolean

Returns:

value of logStatementText
getLogStatementText
()

Get value of logStatementText.

public OptimizerFactory
getOptimizerFactory()

get the optimizer factory to use with this language connection context.

public OptTrace
getOptimizerTracer()

Get the optimizer tracer (could be null if we aren't tracing the optimizer).

public int
getPrepareIsolationLevel()

Get the prepare isolation level.

public Map<Object, Object>

Returns:

the map
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.

public FormatableBitSet

Returns:

the map
getReferencedColumnMap
(TableDescriptor td)

Get the referenced column map for a table

public boolean
getRunTimeStatisticsMode()

Get the RUNTIMESTATISTICS mode.

public RunTimeStatistics
getRunTimeStatisticsObject()

Get the RUNTIMESTATISTICS object.

public String

Returns:

String the authorization id
getSessionUserId
()

Get the Authorization Id of the session user

public StatementContext
getStatementContext()

Get the current StatementContext.

public int

Returns:

a statement level >= OUTERMOST_STATEMENT
getStatementDepth
()

Reports how many statement levels deep we are.

public boolean
getStatisticsTiming()

Get the STATISTICS TIMING mode.

public TableDescriptor

Returns:

TableDescriptor if found the temporary table. Else return null
getTableDescriptorForDeclaredGlobalTempTable
(String
Get table descriptor for the passed table name
tableName
)

Get table descriptor for the declared global temporary table from the list of temporary tables known by this connection.

public SQLSessionContext

Returns:

the requested session context
getTopLevelSQLSessionContext
()

Get the value of top level session context of the top level connection.

public TransactionController
getTransactionCompile()

Get the transaction controller to use with this language connection context at compile time.

public TransactionController
getTransactionExecute()

Get the transaction controller to use with this language connection context during execute time.

public TriggerExecutionContext

Returns:

the tec
getTriggerExecutionContext
()

Get the topmost tec.

public TableDescriptor

Returns:

the table descriptor, or null if we aren't in the middle of compiling a create trigger.
getTriggerTable
()

Get the topmost trigger table descriptor

public String
getUniqueCursorName()

Get a connection unique system generated name for a cursor.

public int
getUniqueSavepointID()

Get a connection unique system generated id for an unnamed savepoint.

public String
getUniqueSavepointName()

Get a connection unique system generated name for an unnamed savepoint.

public boolean
getXplainOnlyMode()

gets the current set XplainOnlyMode

public String

Returns:

the Schema of Xplain, may be null.
getXplainSchema
()

gets the current set XplainSchema

public Object
public int

Returns:

The new bind count
incrementBindCount
()

Increment the DataDictionary bind count.

public void
initialize()

Initialize.

public void
internalCommit(boolean
true if we should commit the Store transaction
commitStore
)

Do a commit, as internally needed by Derby.

public void
internalCommitNoSync(int
the flags to pass to commitNoSync in the store's TransactionController
commitflag
)

Similar to internalCommit() but has logic for an unsynchronized commit

public void
internalRollback()

Do a rollback, as internally needed by Derby.

public void
internalRollbackToSavepoint(String
Name of the savepoint that needs to be rolled back
savepointName
,
boolean
boolean indicating whether or not the controller should close open conglomerates and scans. Also used to determine if language should close open activations.
refreshStyle
,
Object
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
kindOfSavepoint
)

Let the context deal with a rollback to savepoint

public boolean

Returns:

true if the constraint is deferred
isEffectivelyDeferred
(SQLSessionContext
The SQL session context for which we are asking the status
sc
,
UUID
The constraint id we are inquiring about.
constraintId
)

Determines if a check or foreign key constraint has deferred mode.

public boolean

Returns:

true
isInitialDefaultSchema
(String schemaName)

Return true if this schema name is the initial default schema for the current session.

public boolean
isIsolationLevelSetUsingSQLorJDBC()

Returns true if isolation level has been set using JDBC/SQL.

public boolean
isReadOnly()

Get the readOnly status for the current connection.

public boolean

Returns:

true if there is outstanding work in the transaction false otherwise
isTransactionPristine
()

Reports whether there is any outstanding work in the transaction.

public void
languageSetSavePoint(String
name of savepoint
savepointName
,
Object
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
kindOfSavepoint
)

Sets a savepoint.

public Long
lastAutoincrementValue(String schemaName, String tableName, String columnName)

Returns the last autoincrement value inserted by this connection.

public CursorActivation

Returns:

the activation for the given cursor, null if none exists.
lookupCursorActivation
(String cursorName)

See if a given cursor is available for use.

public void
markTempTableAsModifiedInUnitOfWork(String
Mark the passed temporary table name as modified
tableName
)

Mark the passed temporary table as modified in the current unit of work.

public long
nextAutoincrementValue(String schemaName, String tableName, String
identify the column uniquely in the system.
columnName
)

returns the next value to be inserted into an autoincrement col.

public void
notifyUnusedActivation()

Make a note that some activations are marked unused

public boolean

Returns:

Whether or not optimizer trace is on.
optimizerTracingIsOn
()

Get whether or not optimizer trace is on.

public void
popCompilerContext(CompilerContext
The compiler context.
compilerContext
)

Pop a CompilerContext off the context stack.

public void
popExecutionStmtValidator(ExecutionStmtValidator
the validator to remove
validator
)

Remove the validator.

public void
popNestedSessionContext(Activation
activation
a
)

If returning from a routine that can execute SQL, perform any actions needed when popping the SQL session context.

public void
popStatementContext(StatementContext
The statement context.
statementContext
,
Throwable
The error, if any (Only relevant for DEBUG)
error
)

Pop a StatementContext of the context stack.

public void
popTriggerExecutionContext(TriggerExecutionContext
the tec to remove
tec
)

Remove the tec.

public void
popTriggerTable(TableDescriptor
the table to remove from the stack.
td
)

Remove the trigger table descriptor.

public PreparedStatement
prepareInternalStatement(SchemaDescriptor
schema
compilationSchema
,
String
sql query string
sqlText
,
boolean
read only status for resultset. Set to true if the concurrency mode for the resultset is CONCUR_READ_ONLY
isForReadOnly
,
boolean
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.
allowInternalSyntax
)

Return a PreparedStatement object for the query.

public PreparedStatement
prepareInternalStatement(String
sql query string
sqlText
)

Return a PreparedStatement object for the query.

public CompilerContext

Returns:

the compiler context
pushCompilerContext
()

Push a CompilerContext on the context stack with the current default schema as the default schema which we compile against.

public CompilerContext

Returns:

the compiler context
pushCompilerContext
(SchemaDescriptor
the default schema
sd
)

Push a CompilerContext on the context stack with the passed in default schema as the default schema we compile against.

public void
pushExecutionStmtValidator(ExecutionStmtValidator
the validator to add
validator
)

Push a new execution statement validator.

public void
pushNestedSessionContext(Activation
activation of the statement which performs the call.
a
,
boolean
if the method should run with definer's rights
definersRights
,
String
authorization id of the definer
definer
)

Create a new SQL session context for the current activation on the basis of the existing SQL session context.

public StatementContext

Returns:

StatementContext The statement context.
pushStatementContext
(boolean
whether a commit/rollback is permitted from a nested connection under this statement
isAtomic
,
boolean isForReadOnly, String
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.
stmtText
,
ParameterValueSet
parameter value set, if it has one
pvs
,
boolean
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.
rollbackParentContext
,
long
Timeout value for this statement, in milliseconds. Zero means no timeout.
timeoutMillis
)

Push a StatementContext on the context stack.

public void
pushTriggerExecutionContext(TriggerExecutionContext
the trigger execution context
tec
)

Push a new trigger execution context.

public void
pushTriggerTable(TableDescriptor
the table that the trigger is defined upon
td
)

Set the trigger table descriptor.

public void
releaseSavePoint(String
Name of the savepoint that needs to be released
savepointName
,
Object
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
kindOfSavepoint
)

Let the context deal with a release of a savepoint

public void
removeActivation(Activation a)

Remove the activation from those known about by this connection.

public void
resetFromPool()

Reset the connection before it is returned (indirectly) by a PooledConnection object.

public void
resetIsolationLevelFlagUsedForSQLandJDBC()

Reset the isolation level flag used to keep correct isolation level state in BrokeredConnection.

public void
resetSchemaUsages(Activation
current activation
activation
,
String
the schema name occurences of which is to be reset
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.

public boolean

Returns:

true if the role can be set
roleIsSettable
(Activation
activation
a
,
String
string containing role name
role
)

Checks whether the given role can be legally set for the current user.

public void
setASTVisitor(ASTVisitor
The Visitor which should walk the tree. Could be null.
visitor
)

Set a Visitor which walks the AST at various stages.

public void
setAutoincrementUpdate(boolean
the value for autoincrementUpdate (TRUE or FALSE)
flag
)

Sets autoincrementUpdate-- this variable allows updates to autoincrement columns if it is set to true.

public void
setConstraintDeferred(Activation
Activation
a
,
ConstraintDescriptor
The descriptor of the constraint
cd
,
boolean
The new constraint mode
deferred
)

Set the constraint mode for this constraint to deferred.

public void
setCurrentRole(Activation
activation of set role statement
a
,
String
the id of the role to be set to current
role
)

Set the current role

public 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.

public void
setDefaultSchema(SchemaDescriptor
the new default schema. If null, then the default schema descriptor is used.
sd
)

Set the default schema (at compile-time, see explanations for getDefaultSchema overloads).

public void
setDefaultSchema(Activation
current activation
a
,
SchemaDescriptor
the new default schema. If null, then the default schema descriptor is used.
sd
)

Set the default schema (at execution time, see explanations for getDefaultSchema overloads); This version is used by SET SCHEMA.

public void
setDeferredAll(Activation
The activation
a
,
boolean
The value which holds the constraint mode
deferred
)

Set the constraint mode of all deferrable constraints to the value of deferred.

public void
setDrdaID(String
DRDA ID.
drdaID
)

Set the DRDA ID of this LCC.

public void
setIdentityValue(long
the generated identity column value
val
)

Set the field of most recently generated identity column value.

public void
setInterruptedException(StandardException
the created exception
e
)

Set the exception created and associated with the detected interruped status flag.

public void
setIsolationLevel(int
The new isolationLevel.
isolationLevel
)

Set current isolation level.

public void
setLastQueryTree(Object queryTree)

Debug method for remembering the last query tree.

public void
setLogStatementText(boolean
Whether or not logStatementText property is set.
logStatementText
)

Set value of logStatementText (Whether or not to write info on currently executing statement to error log.)

public void
setOptimizerTracer(OptTrace
Null if tracing is being turned off, otherwise an optimizer tracer
tracer
)

Install an optimizer tracer (to enable tracing) or uninstall the current optimizer tracer (to disable tracing).

public void
setPrepareIsolationLevel(int isolationLevel)

public void
setReadOnly(boolean
true sets the connection to be readOnly and false sets it to readWrite.
onOrOff
)

Set the readOnly status for the current connection.

public void
setReferencedColumnMap(TableDescriptor
the table descriptor
td
,
FormatableBitSet
the map
map
)

Set the referenced column map for a table

public void
setRunTimeStatisticsMode(boolean onOrOff)

Turn RUNTIMESTATISTICS on or off.

public void
setRunTimeStatisticsObject(RunTimeStatistics runTimeStatisticsObject)

Set the RUNTIMESTATISTICS object.

public void
setStatisticsTiming(boolean onOrOff)

Turn STATISTICS TIMING on or off.

public void
setupSubStatementSessionContext(Activation a)

Used when a statement as part of its operation executes an other statement.

public void
setXplainOnlyMode(boolean
true if statements are to be XPLAINed only.
onOrOff
)

sets the XplainOnlyMode.

public void
setXplainSchema(String
the schema to use for storing XPLAIN'd statements null means don't store the xplain information non-null means persistent style, use the indicated schema
schema
)

sets the XplainSchema

public void
public void
userCommit()

Do a commit, as issued directly by a user (e.g. via Connection.commit() or the JSQL 'COMMIT' statement.

public void
userRollback()

Do a rollback, as issued directly by a user (e.g. via Connection.rollback() or the JSQL 'ROLLBACK' statement.

public boolean

Returns:

True if SQL standard permissions are being used
usesSqlAuthorization
()

Check if in SQL standard mode, with support for Grant and Revoke

public void
validateStmtExecution(ConstantAction
the constantAction that is about to be executed (and should be validated
constantAction
)

Validate a statement.

public boolean

Returns:

boolean Found no open resultsets.
verifyAllHeldResultSetsAreClosed
()

Verify that there are no activations with open held result sets.

public boolean

Returns:

Nothing.
verifyNoOpenResultSets
(PreparedStatement
The prepared Statement
pStmt
,
Provider
The object precipitating a possible invalidation
provider
,
int
The action causing the possible invalidation
action
)

Verify that there are no activations with open result sets on the specified prepared statement.

public void
xaCommit(boolean
if true, allow it to commit without first going thru a prepared state.
onePhase
)

Commit a distrubuted transaction.

public void
xaRollback()

Roll back a distrubuted transaction.

Inherited from org.apache.derby.iapi.services.context.Context:
cleanupOnErrorgetContextManagergetIdNameisLastHandlerpopMepushMe