Context, StatementContextfinal class GenericStatementContext extends ContextImpl implements StatementContext
| Modifier and Type | Class | Description |
|---|---|---|
private static class |
GenericStatementContext.CancelQueryTask |
This is a TimerTask that is responsible for timing out statements,
typically when an application has called Statement.setQueryTimeout().
|
| Modifier and Type | Field | Description |
|---|---|---|
private Activation |
activation |
The activation associated with this context, or null
|
private boolean |
cancellationFlag |
|
private GenericStatementContext.CancelQueryTask |
cancelTask |
|
private java.util.ArrayList<Dependency> |
dependencies |
|
private java.lang.String |
internalSavePointName |
|
private boolean |
inUse |
|
private boolean |
isAtomic |
|
private boolean |
isForReadOnly |
|
private boolean |
isSystemCode |
|
private LanguageConnectionContext |
lcc |
|
private NoPutResultSet[] |
materializedSubqueries |
|
private boolean |
parentInTrigger |
|
private ParameterValueSet |
pvs |
|
private boolean |
rollbackParentContext |
|
private boolean |
setSavePoint |
|
private short |
sqlAllowed |
Set to one of RoutineAliasInfo.
|
private SQLSessionContext |
sqlSessionContext |
The SQLSessionContext associated with a statement context.
|
private boolean |
statementWasInvalidated |
|
private java.lang.String |
stmtText |
|
private NoPutResultSet[] |
subqueryTrackingArray |
|
private ResultSet |
topResultSet |
| Constructor | Description |
|---|---|
GenericStatementContext(LanguageConnectionContext lcc) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addDependency(Dependency dy) |
Track a Dependency within this StatementContext.
|
java.lang.StringBuffer |
appendErrorInfo() |
|
void |
cancel() |
Cancels the statement which has allocated this StatementContext object.
|
void |
cleanupOnError(java.lang.Throwable error) |
Close down the top ResultSet, if relevant, and rollback to the
internal savepoint, if one was set.
|
void |
clearInUse() |
Mark this context as not in use.
|
void |
clearSavePoint() |
Clear the save point for the current statement.
|
Activation |
getActivation() |
Get activation associated with this statement context, if any.
|
short |
getSQLAllowed() |
Get the setting of the SQL allowed state.
|
SQLSessionContext |
getSQLSessionContext() |
Get the current SQL session context.
|
java.lang.String |
getStatementText() |
Return the text of the current statement.
|
boolean |
getStatementWasInvalidated() |
Tells if this statement has been invalidated.
|
NoPutResultSet[] |
getSubqueryTrackingArray() |
Get the subquery tracking array for this query.
|
boolean |
getSystemCode() |
Return true if this statement is system code.
|
private static TimerFactory |
getTimerFactory() |
|
boolean |
inTrigger() |
Returns whether we started from within the context of a trigger
or not.
|
boolean |
inUse() |
Is this statement context in use or not.
|
boolean |
isAtomic() |
Indicates whether the statement needs to be executed atomically
or not, i.e., whether a commit/rollback is permitted by a
connection nested in this statement.
|
boolean |
isCancelled() |
Tests whether the statement which has allocated this StatementContext
object has been cancelled.
|
boolean |
isForReadOnly() |
Is this statement for a read only, non-updatable ResultSet
|
boolean |
isLastHandler(int severity) |
Return whether or not this context is the "last" handler for a
the specified severity level.
|
boolean |
onStack() |
Reports whether this StatementContext is on the context stack.
|
private void |
pleaseBeOnStack() |
Raise an exception if this Context is not in use, that is, on the
Context Stack.
|
void |
resetSavePoint() |
Resets the savepoint to the current spot if it is
set, otherwise, noop.
|
void |
setActivation(Activation a) |
Mark this statement context as associated with this activation.
|
void |
setInUse(boolean parentInTrigger,
boolean isAtomic,
boolean isForReadOnly,
java.lang.String stmtText,
ParameterValueSet pvs,
long timeoutMillis) |
Mark this context as being in use.
|
void |
setParentRollback() |
Indicate that, in the event of a statement-level exception,
this context is NOT the last one that needs to be rolled
back--rather, it is nested within some other statement
context, and that other context needs to be rolled back,
too.
|
void |
setSavePoint() |
Set a save point for the current statement.
|
void |
setSQLAllowed(short allow,
boolean force) |
Set the level of SQL allowed in this and subsequent
nested statements due to a routine call.
|
void |
setSQLSessionContext(SQLSessionContext ctx) |
Set the current SQL session context
|
void |
setSubqueryResultSet(int subqueryNumber,
NoPutResultSet subqueryResultSet,
int numSubqueries) |
Set the appropriate entry in the subquery tracking array for
the specified subquery.
|
void |
setSystemCode() |
Set to indicate statement is system code.
|
void |
setTopResultSet(ResultSet topResultSet,
NoPutResultSet[] subqueryTrackingArray) |
Set the top ResultSet in the ResultSet tree for close down on
an error.
|
private void |
stuffTopResultSet(ResultSet topResultSet,
NoPutResultSet[] subqueryTrackingArray) |
Private minion of setTopResultSet() and clearInUse()
|
getContextManager, getIdName, popMe, pushMegetContextManager, getIdName, popMe, pushMeprivate boolean setSavePoint
private java.lang.String internalSavePointName
private ResultSet topResultSet
private java.util.ArrayList<Dependency> dependencies
private NoPutResultSet[] subqueryTrackingArray
private NoPutResultSet[] materializedSubqueries
private final LanguageConnectionContext lcc
private boolean inUse
private volatile boolean cancellationFlag
private GenericStatementContext.CancelQueryTask cancelTask
private boolean parentInTrigger
private boolean isForReadOnly
private boolean isAtomic
private boolean isSystemCode
private boolean rollbackParentContext
private boolean statementWasInvalidated
private java.lang.String stmtText
private ParameterValueSet pvs
private short sqlAllowed
private Activation activation
private SQLSessionContext sqlSessionContext
GenericStatementContext(LanguageConnectionContext lcc)
private static TimerFactory getTimerFactory()
public void setInUse(boolean parentInTrigger,
boolean isAtomic,
boolean isForReadOnly,
java.lang.String stmtText,
ParameterValueSet pvs,
long timeoutMillis)
StatementContextsetInUse in interface StatementContextparentInTrigger - true if the parent started in the context of a triggerisAtomic - true if the statement must be executed
atomicallyisForReadOnly - true if the statement is for producing non-updatable
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 onetimeoutMillis - timeout value for the statement, in milliseconds.
Zero means no timeout.public void clearInUse()
StatementContextclearInUse in interface StatementContextpublic void setSavePoint()
throws StandardException
StatementContextsetSavePoint in interface StatementContextStandardException - Thrown on errorStatementContext.setSavePoint()public void resetSavePoint()
throws StandardException
resetSavePoint in interface StatementContextStandardException - Thrown on errorStatementContext.resetSavePoint()public void clearSavePoint()
throws StandardException
StatementContextclearSavePoint in interface StatementContextStandardException - Thrown on errorStatementContext.clearSavePoint()public void setTopResultSet(ResultSet topResultSet, NoPutResultSet[] subqueryTrackingArray) throws StandardException
setTopResultSet in interface StatementContexttopResultSet - The top ResultSet in the ResultSet treesubqueryTrackingArray - (Sparse) of tops of subquery ResultSet treesStandardException - thrown on error.private void stuffTopResultSet(ResultSet topResultSet, NoPutResultSet[] subqueryTrackingArray)
topResultSet - make this the top result setsubqueryTrackingArray - where to keep track of subqueries in this statementpublic void setSubqueryResultSet(int subqueryNumber,
NoPutResultSet subqueryResultSet,
int numSubqueries)
throws StandardException
setSubqueryResultSet in interface StatementContextsubqueryNumber - The subquery # for this subquerysubqueryResultSet - The ResultSet at the top of the subquerynumSubqueries - The total # of subqueries in the entire queryStandardException - thrown on error.public NoPutResultSet[] getSubqueryTrackingArray() throws StandardException
getSubqueryTrackingArray in interface StatementContextStandardException - thrown on error.public void addDependency(Dependency dy) throws StandardException
addDependency in interface StatementContextdy - The dependency to track.StandardException - thrown on error.public boolean inTrigger()
inTrigger in interface StatementContextpublic void cleanupOnError(java.lang.Throwable error)
throws StandardException
cleanupOnError in interface ContextStandardException - thrown on error. REVISIT: don't want
cleanupOnError's to throw exceptions.public boolean isLastHandler(int severity)
ContextisLastHandler in interface ContextisLastHandler in class ContextImplContext.isLastHandler(int)public boolean onStack()
onStack in interface StatementContextpublic boolean isAtomic()
isAtomic in interface StatementContextpublic java.lang.String getStatementText()
getStatementText in interface StatementContextprivate void pleaseBeOnStack()
throws StandardException
StandardException - thrown on error.public boolean inUse()
StatementContextinUse in interface StatementContextpublic boolean isForReadOnly()
StatementContextisForReadOnly in interface StatementContextpublic boolean isCancelled()
isCancelled in interface StatementContextpublic void cancel()
cancel in interface StatementContextpublic void setSQLAllowed(short allow,
boolean force)
StatementContextsetSQLAllowed in interface StatementContextforce - set to true to override more restrictive setting. Used to
reset the permissions after a function call.public short getSQLAllowed()
StatementContextgetSQLAllowed in interface StatementContextpublic void setParentRollback()
setParentRollback in interface StatementContextpublic void setSystemCode()
setSystemCode in interface StatementContextpublic boolean getSystemCode()
getSystemCode in interface StatementContextpublic java.lang.StringBuffer appendErrorInfo()
appendErrorInfo in class ContextImplpublic void setActivation(Activation a)
StatementContextsetActivation in interface StatementContexta - activationStatementContext.setActivation(Activation a)public Activation getActivation()
StatementContextgetActivation in interface StatementContextStatementContext.getActivation()public SQLSessionContext getSQLSessionContext()
StatementContextgetSQLSessionContext in interface StatementContextStatementContext.getSQLSessionContext()public void setSQLSessionContext(SQLSessionContext ctx)
StatementContextsetSQLSessionContext in interface StatementContextctx - the SQL session contextStatementContext.setSQLSessionContext(SQLSessionContext ctx)public boolean getStatementWasInvalidated()
StatementContextgetStatementWasInvalidated in interface StatementContexttrue if the statement was invalidated.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.