|
|||||||||
| 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.GenericStatementContext
final class GenericStatementContext
GenericStatementContext is pushed/popped around a statement prepare and execute so that any statement specific clean up can be performed.
| Nested Class Summary | |
|---|---|
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 | |
|---|---|
private Activation |
activation
The activation associated with this context, or null |
private boolean |
cancellationFlag
|
private GenericStatementContext.CancelQueryTask |
cancelTask
|
private java.util.ArrayList |
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 Summary | |
|---|---|
GenericStatementContext(LanguageConnectionContext lcc)
|
|
| Method Summary | |
|---|---|
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. |
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() |
| 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 boolean setSavePoint
private java.lang.String internalSavePointName
private ResultSet topResultSet
private java.util.ArrayList 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
| Constructor Detail |
|---|
GenericStatementContext(LanguageConnectionContext lcc)
| Method Detail |
|---|
public void setInUse(boolean parentInTrigger,
boolean isAtomic,
boolean isForReadOnly,
java.lang.String stmtText,
ParameterValueSet pvs,
long timeoutMillis)
StatementContext
setInUse 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()
StatementContext
clearInUse in interface StatementContext
public void setSavePoint()
throws StandardException
StatementContext
setSavePoint 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
StatementContext
clearSavePoint 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 trees
StandardException - 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 statement
public 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 query
StandardException - 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 StatementContext
public 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)
Context
isLastHandler 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 StatementContext
private void pleaseBeOnStack()
throws StandardException
StandardException - thrown on error.public boolean inUse()
StatementContext
inUse in interface StatementContextpublic boolean isForReadOnly()
StatementContext
isForReadOnly in interface StatementContextpublic boolean isCancelled()
isCancelled in interface StatementContextpublic void cancel()
cancel in interface StatementContext
public void setSQLAllowed(short allow,
boolean force)
StatementContext
setSQLAllowed in interface StatementContextforce - set to true to override more restrictive setting. Used to
reset the permissions after a function call.public short getSQLAllowed()
StatementContext
getSQLAllowed 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)
StatementContext
setActivation in interface StatementContexta - activationStatementContext.setActivation(Activation a)public Activation getActivation()
StatementContext
getActivation in interface StatementContextStatementContext.getActivation()public SQLSessionContext getSQLSessionContext()
StatementContext
getSQLSessionContext in interface StatementContextStatementContext.getSQLSessionContext()public void setSQLSessionContext(SQLSessionContext ctx)
StatementContext
setSQLSessionContext in interface StatementContextctx - the SQL session contextStatementContext.setSQLSessionContext(SQLSessionContext ctx)public boolean getStatementWasInvalidated()
StatementContext
getStatementWasInvalidated in interface StatementContexttrue if the statement was invalidated.
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||