Top Description Inners Fields Constructors Methods
org.apache.derby.impl.sql.conn

pack-priv final Class GenericStatementContext

extends ContextImpl
implements StatementContext
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.conn.StatementContext, org.apache.derby.iapi.services.context.Context
Imports
org.apache.derby.iapi.services.context.Context, .ContextImpl, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.iapi.services.timer.TimerFactory, org.apache.derby.shared.common.error.StandardException, .ExceptionSeverity, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .StatementContext, .SQLSessionContext, org.apache.derby.iapi.sql.depend.Dependency, .DependencyManager, org.apache.derby.iapi.sql.execute.NoPutResultSet, org.apache.derby.iapi.sql.Activation, .ResultSet, .ParameterValueSet, org.apache.derby.shared.common.reference.SQLState, java.util.ArrayList, .Iterator, .TimerTask

GenericStatementContext is pushed/popped around a statement prepare and execute so that any statement specific clean up can be performed.

Nested and Inner Type Summary

Modifier and TypeClass 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().

Field Summary

Modifier and TypeField and Description
private Activation
activation

The activation associated with this context, or null

private volatile boolean
private GenericStatementContext.CancelQueryTask
private ArrayList<Dependency>
private String
private boolean
private boolean
private boolean
private boolean
private final LanguageConnectionContext
private NoPutResultSet[]
private boolean
private ParameterValueSet
private boolean
private boolean
private short
sqlAllowed

Set to one of RoutineAliasInfo.{MODIFIES_SQL_DATA, READS_SQL_DATA, CONTAINS_SQL, NO_SQL}

private SQLSessionContext
sqlSessionContext

The SQLSessionContext associated with a statement context.

private boolean
private String
private NoPutResultSet[]
private ResultSet

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addDependency(Dependency
The dependency to track.
dy
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.addDependency.

Track a Dependency within this StatementContext.

public StringBuffer
public void
cancel()

Implements org.apache.derby.iapi.sql.conn.StatementContext.cancel.

Cancels the statement which has allocated this StatementContext object.

public void
cleanupOnError(Throwable
The original error
error
)

Implements org.apache.derby.iapi.services.context.Context.cleanupOnError.

Close down the top ResultSet, if relevant, and rollback to the internal savepoint, if one was set.

public void
clearInUse()

Implements org.apache.derby.iapi.sql.conn.StatementContext.clearInUse.

Mark this context as not in use.

public void
clearSavePoint()

Implements org.apache.derby.iapi.sql.conn.StatementContext.clearSavePoint.

Clear the save point for the current statement.

public Activation
getActivation()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getActivation.

Get activation associated with this statement context, if any.

public short
getSQLAllowed()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSQLAllowed.

Get the setting of the SQL allowed state.

public SQLSessionContext
public String

Returns:

the statement text
getStatementText
()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getStatementText.

Return the text of the current statement.

public boolean
public NoPutResultSet[]

Returns:

NoPutResultSet[] The (sparse) array of tops of subquery ResultSet trees
getSubqueryTrackingArray
()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSubqueryTrackingArray.

Get the subquery tracking array for this query.

public boolean
getSystemCode()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSystemCode.

Return true if this statement is system code.

private static TimerFactory
public boolean

Returns:

true if we are in a trigger context
inTrigger
()

Implements org.apache.derby.iapi.sql.conn.StatementContext.inTrigger.

Returns whether we started from within the context of a trigger or not.

public boolean
inUse()

Implements org.apache.derby.iapi.sql.conn.StatementContext.inUse.

Is this statement context in use or not.

public boolean

Returns:

true if needs to be atomic
isAtomic
()

Implements org.apache.derby.iapi.sql.conn.StatementContext.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.

public boolean

Returns:

whether the statement which has allocated this StatementContext object has been cancelled.
isCancelled
()

Implements org.apache.derby.iapi.sql.conn.StatementContext.isCancelled.

Tests whether the statement which has allocated this StatementContext object has been cancelled.

public boolean
isForReadOnly()

Implements org.apache.derby.iapi.sql.conn.StatementContext.isForReadOnly.

Is this statement for a read only, non-updatable ResultSet

public boolean
isLastHandler(int
The severity level
severity
)

Overrides org.apache.derby.iapi.services.context.ContextImpl.isLastHandler.

Implements org.apache.derby.iapi.services.context.Context.isLastHandler.

Return whether or not this context is the "last" handler for a the specified severity level.

public boolean

Returns:

true if this StatementContext is on the context stack. false otherwise.
onStack
()

Implements org.apache.derby.iapi.sql.conn.StatementContext.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.

public void
resetSavePoint()

Implements org.apache.derby.iapi.sql.conn.StatementContext.resetSavePoint.

Resets the savepoint to the current spot if it is set, otherwise, noop.

public void
setActivation(Activation
activation
a
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setActivation.

Mark this statement context as associated with this activation.

public void
setInUse(boolean
true if the parent started in the context of a trigger
parentInTrigger
,
boolean
true if the statement must be executed atomically
isAtomic
,
boolean
true if the statement is for producing non-updatable resultset
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
,
long
timeout value for the statement, in milliseconds. Zero means no timeout.
timeoutMillis
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setInUse.

Mark this context as being in use.

public void
setParentRollback()

Implements org.apache.derby.iapi.sql.conn.StatementContext.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.

public void
setSavePoint()

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSavePoint.

Set a save point for the current statement.

public void
setSQLAllowed(short allow, boolean
set to true to override more restrictive setting. Used to reset the permissions after a function call.
force
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSQLAllowed.

Set the level of SQL allowed in this and subsequent nested statements due to a routine call.

public void
setSQLSessionContext(SQLSessionContext
the SQL session context
ctx
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSQLSessionContext.

Set the current SQL session context

public void
setSubqueryResultSet(int
The subquery # for this subquery
subqueryNumber
,
NoPutResultSet
The ResultSet at the top of the subquery
subqueryResultSet
,
int
The total # of subqueries in the entire query
numSubqueries
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSubqueryResultSet.

Set the appropriate entry in the subquery tracking array for the specified subquery.

public void
setSystemCode()

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSystemCode.

Set to indicate statement is system code.

public void
setTopResultSet(ResultSet
The top ResultSet in the ResultSet tree
topResultSet
,
NoPutResultSet[]
(Sparse) of tops of subquery ResultSet trees
subqueryTrackingArray
)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setTopResultSet.

Set the top ResultSet in the ResultSet tree for close down on an error.

private void
stuffTopResultSet(ResultSet
make this the top result set
topResultSet
,
NoPutResultSet[]
where to keep track of subqueries in this statement
subqueryTrackingArray
)

Private minion of setTopResultSet() and clearInUse()

Inherited from org.apache.derby.iapi.services.context.ContextImpl:
getContextManagergetIdNamepopMepushMe

Field Detail

activationback to summary
private Activation activation

The activation associated with this context, or null

cancellationFlagback to summary
private volatile boolean cancellationFlag
cancelTaskback to summary
private GenericStatementContext.CancelQueryTask cancelTask
dependenciesback to summary
private ArrayList<Dependency> dependencies
internalSavePointNameback to summary
private String internalSavePointName
inUseback to summary
private boolean inUse
isAtomicback to summary
private boolean isAtomic
isForReadOnlyback to summary
private boolean isForReadOnly
isSystemCodeback to summary
private boolean isSystemCode
lccback to summary
private final LanguageConnectionContext lcc
materializedSubqueriesback to summary
private NoPutResultSet[] materializedSubqueries
parentInTriggerback to summary
private boolean parentInTrigger
pvsback to summary
private ParameterValueSet pvs
rollbackParentContextback to summary
private boolean rollbackParentContext
setSavePointback to summary
private boolean setSavePoint
sqlAllowedback to summary
private short sqlAllowed

Set to one of RoutineAliasInfo.{MODIFIES_SQL_DATA, READS_SQL_DATA, CONTAINS_SQL, NO_SQL}

sqlSessionContextback to summary
private SQLSessionContext sqlSessionContext

The SQLSessionContext associated with a statement context.

statementWasInvalidatedback to summary
private boolean statementWasInvalidated
stmtTextback to summary
private String stmtText
subqueryTrackingArrayback to summary
private NoPutResultSet[] subqueryTrackingArray
topResultSetback to summary
private ResultSet topResultSet

Constructor Detail

GenericStatementContextback to summary
pack-priv GenericStatementContext(LanguageConnectionContext lcc)

Method Detail

addDependencyback to summary
public void addDependency(Dependency dy) throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.addDependency.

Track a Dependency within this StatementContext. (We need to clear any dependencies added within this context on an error.

Parameters
dy:Dependency

The dependency to track.

Exceptions
StandardException:
thrown on error.
appendErrorInfoback to summary
public StringBuffer appendErrorInfo()

Overrides org.apache.derby.iapi.services.context.ContextImpl.appendErrorInfo.

cancelback to summary
public void cancel()

Implements org.apache.derby.iapi.sql.conn.StatementContext.cancel.

Cancels the statement which has allocated this StatementContext object. This is done by setting a flag in the StatementContext object. For this to have any effect, it is the responsibility of the executing statement to check this flag regularly.

cleanupOnErrorback to summary
public void cleanupOnError(Throwable error) throws StandardException

Implements org.apache.derby.iapi.services.context.Context.cleanupOnError.

Close down the top ResultSet, if relevant, and rollback to the internal savepoint, if one was set.

Parameters
error:Throwable

Doc from org.apache.derby.iapi.services.context.Context.cleanupOnError.

The original error

Exceptions
StandardException:
thrown on error. REVISIT: don't want cleanupOnError's to throw exceptions.
clearInUseback to summary
public void clearInUse()

Implements org.apache.derby.iapi.sql.conn.StatementContext.clearInUse.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.clearInUse.

Mark this context as not in use. This is important because we always leave the top statement context on the stack, and we don't want to clean it up if a statement level exception happens while the context is not in use.

clearSavePointback to summary
public void clearSavePoint() throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.clearSavePoint.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.clearSavePoint.

Clear the save point for the current statement.

Exceptions
StandardException:
Thrown on error
See Also
StatementContext#clearSavePoint
getActivationback to summary
public Activation getActivation()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getActivation.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.getActivation.

Get activation associated with this statement context, if any. Used to link up stack of activations of calls in nested connections, see GenericPreparedStatement#getActivation.

See Also
StatementContext#getActivation
getSQLAllowedback to summary
public short getSQLAllowed()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSQLAllowed.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.getSQLAllowed.

Get the setting of the SQL allowed state.

getSQLSessionContextback to summary
public SQLSessionContext getSQLSessionContext()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSQLSessionContext.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.getSQLSessionContext.

Get the current SQL session context.

Returns:SQLSessionContext

the current SQL session context

See Also
StatementContext#getSQLSessionContext
getStatementTextback to summary
public String getStatementText()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getStatementText.

Return the text of the current statement. Note that this may be null. It is currently not set up correctly for ResultSets that aren't single row result sets (e.g SELECT), replication, and setXXXX/getXXXX jdbc methods.

Returns:String

the statement text

getStatementWasInvalidatedback to summary
public boolean getStatementWasInvalidated()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getStatementWasInvalidated.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.getStatementWasInvalidated.

Tells if this statement has been invalidated.

Returns:boolean

true if the statement was invalidated.

getSubqueryTrackingArrayback to summary
public NoPutResultSet[] getSubqueryTrackingArray() throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSubqueryTrackingArray.

Get the subquery tracking array for this query. (Useful for runtime statistics.)

Returns:NoPutResultSet[]

NoPutResultSet[] The (sparse) array of tops of subquery ResultSet trees

Exceptions
StandardException:
thrown on error.
getSystemCodeback to summary
public boolean getSystemCode()

Implements org.apache.derby.iapi.sql.conn.StatementContext.getSystemCode.

Return true if this statement is system code.

getTimerFactoryback to summary
private static TimerFactory getTimerFactory()
inTriggerback to summary
public boolean inTrigger()

Implements org.apache.derby.iapi.sql.conn.StatementContext.inTrigger.

Returns whether we started from within the context of a trigger or not.

Returns:boolean

true if we are in a trigger context

inUseback to summary
public boolean inUse()

Implements org.apache.derby.iapi.sql.conn.StatementContext.inUse.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.inUse.

Is this statement context in use or not.

Returns:boolean

true if in use

isAtomicback to summary
public boolean isAtomic()

Implements org.apache.derby.iapi.sql.conn.StatementContext.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.

Returns:boolean

true if needs to be atomic

isCancelledback to summary
public boolean isCancelled()

Implements org.apache.derby.iapi.sql.conn.StatementContext.isCancelled.

Tests whether the statement which has allocated this StatementContext object has been cancelled. This method is typically called from the thread which is executing the statement, to test whether execution should continue or stop.

Returns:boolean

whether the statement which has allocated this StatementContext object has been cancelled.

isForReadOnlyback to summary
public boolean isForReadOnly()

Implements org.apache.derby.iapi.sql.conn.StatementContext.isForReadOnly.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.isForReadOnly.

Is this statement for a read only, non-updatable ResultSet

Returns:boolean

true if the statement is for creating a read only, non-updatable ResultSet

isLastHandlerback to summary
public boolean isLastHandler(int severity)

Overrides org.apache.derby.iapi.services.context.ContextImpl.isLastHandler.

Implements org.apache.derby.iapi.services.context.Context.isLastHandler.

Doc from org.apache.derby.iapi.services.context.Context.isLastHandler.

Return whether or not this context is the "last" handler for a the specified severity level. Previously, the context manager would march through all of the contexts in cleanupOnError() and call each of their cleanupOnError() methods. That did not work with server side JDBC, especially for a StatementException, because outer contexts could get cleaned up incorrectly. This functionality is specific to the Language system. Any non-language system contexts should return ExceptionSeverity.NOT_APPLICABLE_SEVERITY.

Note

Both the LanguageConnectionContext and the JDBC Connection Context are interested in session level errors because they both have clean up to do. This method allows both of them to return false so that all such handlers under them can do their clean up.

Parameters
severity:int

The severity level

Returns:boolean

whether or not this context is the "last" handler for a severity level

See Also
Context#isLastHandler
onStackback to summary
public boolean onStack()

Implements org.apache.derby.iapi.sql.conn.StatementContext.onStack.

Reports whether this StatementContext is on the context stack.

Returns:boolean

true if this StatementContext is on the context stack. false otherwise.

pleaseBeOnStackback to summary
private void pleaseBeOnStack() throws StandardException

Raise an exception if this Context is not in use, that is, on the Context Stack.

Exceptions
StandardException:
thrown on error.
resetSavePointback to summary
public void resetSavePoint() throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.resetSavePoint.

Resets the savepoint to the current spot if it is set, otherwise, noop. Used when a commit is done on a nested connection.

Exceptions
StandardException:
Thrown on error
See Also
StatementContext#resetSavePoint
setActivationback to summary
public void setActivation(Activation a)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setActivation.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setActivation.

Mark this statement context as associated with this activation.

Parameters
a:Activation

activation

See Also
StatementContext#setActivation(Activation a)
setInUseback to summary
public void setInUse(boolean parentInTrigger, boolean isAtomic, boolean isForReadOnly, String stmtText, ParameterValueSet pvs, long timeoutMillis)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setInUse.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setInUse.

Mark this context as being in use.

Parameters
parentInTrigger:boolean

true if the parent started in the context of a trigger

isAtomic:boolean

true if the statement must be executed atomically

isForReadOnly:boolean

true if the statement is for producing non-updatable resultset

stmtText: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.

pvs:ParameterValueSet

parameter value set, if it has one

timeoutMillis:long

timeout value for the statement, in milliseconds. Zero means no timeout.

setParentRollbackback to summary
public void setParentRollback()

Implements org.apache.derby.iapi.sql.conn.StatementContext.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.

setSavePointback to summary
public void setSavePoint() throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSavePoint.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setSavePoint.

Set a save point for the current statement.

Note

This needs to be off of the StatementContext so that it gets cleared on a statement error.

Exceptions
StandardException:
Thrown on error
See Also
StatementContext#setSavePoint
setSQLAllowedback to summary
public void setSQLAllowed(short allow, boolean force)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSQLAllowed.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setSQLAllowed.

Set the level of SQL allowed in this and subsequent nested statements due to a routine call. Value must be one of RoutineAliasInfo.{MODIFIES_SQL_DATA, READS_SQL_DATA, CONTAINS_SQL, NO_SQL}

Parameters
force:boolean

set to true to override more restrictive setting. Used to reset the permissions after a function call.

setSQLSessionContextback to summary
public void setSQLSessionContext(SQLSessionContext ctx)

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSQLSessionContext.

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setSQLSessionContext.

Set the current SQL session context

Parameters
ctx:SQLSessionContext

the SQL session context

See Also
StatementContext#setSQLSessionContext(SQLSessionContext ctx)
setSubqueryResultSetback to summary
public void setSubqueryResultSet(int subqueryNumber, NoPutResultSet subqueryResultSet, int numSubqueries) throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSubqueryResultSet.

Set the appropriate entry in the subquery tracking array for the specified subquery. Useful for closing down open subqueries on an exception.

Parameters
subqueryNumber:int

The subquery # for this subquery

subqueryResultSet:NoPutResultSet

The ResultSet at the top of the subquery

numSubqueries:int

The total # of subqueries in the entire query

Exceptions
StandardException:
thrown on error.
setSystemCodeback to summary
public void setSystemCode()

Implements org.apache.derby.iapi.sql.conn.StatementContext.setSystemCode.

Set to indicate statement is system code. For example a system procedure, view, function etc.

setTopResultSetback to summary
public void setTopResultSet(ResultSet topResultSet, NoPutResultSet[] subqueryTrackingArray) throws StandardException

Implements org.apache.derby.iapi.sql.conn.StatementContext.setTopResultSet.

Set the top ResultSet in the ResultSet tree for close down on an error.

Parameters
topResultSet:ResultSet

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setTopResultSet.

The top ResultSet in the ResultSet tree

subqueryTrackingArray:NoPutResultSet[]

Doc from org.apache.derby.iapi.sql.conn.StatementContext.setTopResultSet.

(Sparse) of tops of subquery ResultSet trees

Exceptions
StandardException:
thrown on error.
stuffTopResultSetback to summary
private void stuffTopResultSet(ResultSet topResultSet, NoPutResultSet[] subqueryTrackingArray)

Private minion of setTopResultSet() and clearInUse()

Parameters
topResultSet:ResultSet

make this the top result set

subqueryTrackingArray:NoPutResultSet[]

where to keep track of subqueries in this statement

org.apache.derby.impl.sql.conn back to summary

private Class GenericStatementContext.CancelQueryTask

extends TimerTask
Class Inheritance

This is a TimerTask that is responsible for timing out statements, typically when an application has called Statement.setQueryTimeout(). When the application invokes execute() on a statement object, or fetches data on a ResultSet, a StatementContext object is allocated for the duration of the execution in the engine (until control is returned to the application). When the StatementContext object is assigned with setInUse(), a CancelQueryTask is scheduled if a timeout > 0 has been set.

Field Summary

Modifier and TypeField and Description
private StatementContext
statementContext

Reference to the StatementContext for the executing statement which might time out.

Constructor Summary

AccessConstructor and Description
public
CancelQueryTask(StatementContext ctx)

Initializes a new task for timing out a statement's execution.

Method Summary

Modifier and TypeMethod and Description
public void
forgetContext()

Stops this task and prevents it from cancelling a statement.

public void
run()

Implements abstract java.util.TimerTask.run.

Implements java.lang.Runnable.run.

Invoked by a Timer class to cancel an executing statement.

Inherited from java.util.TimerTask:
cancelscheduledExecutionTime

Field Detail

statementContextback to summary
private StatementContext statementContext

Reference to the StatementContext for the executing statement which might time out.

Constructor Detail

CancelQueryTaskback to summary
public CancelQueryTask(StatementContext ctx)

Initializes a new task for timing out a statement's execution. This does not schedule it for execution, the caller is responsible for calling Timer.schedule() with this object as parameter.

Method Detail

forgetContextback to summary
public void forgetContext()

Stops this task and prevents it from cancelling a statement. Guarantees that after this method returns, the associated StatementContext object will not be tampered with by this task. Thus, the StatementContext object may safely be allocated to other executing statements.

runback to summary
public void run()

Implements abstract java.util.TimerTask.run.

Implements java.lang.Runnable.run.

Invoked by a Timer class to cancel an executing statement. This method just sets a volatile flag in the associated StatementContext object by calling StatementContext.cancel(); it is the responsibility of the thread executing the statement to check this flag regularly.