final class GenericStatementContext extends ContextImpl implements StatementContext
Modifier and Type | Class and 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 and 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 and Description |
---|
GenericStatementContext(LanguageConnectionContext lcc) |
Modifier and Type | Method and 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, pushMe
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContextManager, getIdName, popMe, pushMe
private 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)
StatementContext
setInUse
in interface StatementContext
parentInTrigger
- 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()
StatementContext
clearInUse
in interface StatementContext
public void setSavePoint() throws StandardException
StatementContext
setSavePoint
in interface StatementContext
StandardException
- Thrown on errorStatementContext.setSavePoint()
public void resetSavePoint() throws StandardException
resetSavePoint
in interface StatementContext
StandardException
- Thrown on errorStatementContext.resetSavePoint()
public void clearSavePoint() throws StandardException
StatementContext
clearSavePoint
in interface StatementContext
StandardException
- Thrown on errorStatementContext.clearSavePoint()
public void setTopResultSet(ResultSet topResultSet, NoPutResultSet[] subqueryTrackingArray) throws StandardException
setTopResultSet
in interface StatementContext
topResultSet
- 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 StatementContext
subqueryNumber
- 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 StatementContext
StandardException
- thrown on error.public void addDependency(Dependency dy) throws StandardException
addDependency
in interface StatementContext
dy
- The dependency to track.StandardException
- thrown on error.public boolean inTrigger()
inTrigger
in interface StatementContext
public void cleanupOnError(java.lang.Throwable error) throws StandardException
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)
public boolean onStack()
onStack
in interface StatementContext
public boolean isAtomic()
isAtomic
in interface StatementContext
public java.lang.String getStatementText()
getStatementText
in interface StatementContext
private void pleaseBeOnStack() throws StandardException
StandardException
- thrown on error.public boolean inUse()
StatementContext
inUse
in interface StatementContext
public boolean isForReadOnly()
StatementContext
isForReadOnly
in interface StatementContext
public boolean isCancelled()
isCancelled
in interface StatementContext
public void cancel()
cancel
in interface StatementContext
public void setSQLAllowed(short allow, boolean force)
StatementContext
setSQLAllowed
in interface StatementContext
force
- set to true to override more restrictive setting. Used to
reset the permissions after a function call.public short getSQLAllowed()
StatementContext
getSQLAllowed
in interface StatementContext
public void setParentRollback()
setParentRollback
in interface StatementContext
public void setSystemCode()
setSystemCode
in interface StatementContext
public boolean getSystemCode()
getSystemCode
in interface StatementContext
public java.lang.StringBuffer appendErrorInfo()
appendErrorInfo
in class ContextImpl
public void setActivation(Activation a)
StatementContext
setActivation
in interface StatementContext
a
- activationStatementContext.setActivation(Activation a)
public Activation getActivation()
StatementContext
getActivation
in interface StatementContext
StatementContext.getActivation()
public SQLSessionContext getSQLSessionContext()
StatementContext
getSQLSessionContext
in interface StatementContext
StatementContext.getSQLSessionContext()
public void setSQLSessionContext(SQLSessionContext ctx)
StatementContext
setSQLSessionContext
in interface StatementContext
ctx
- the SQL session contextStatementContext.setSQLSessionContext(SQLSessionContext ctx)
public boolean getStatementWasInvalidated()
StatementContext
getStatementWasInvalidated
in interface StatementContext
true
if the statement was invalidated.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.