|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ conn overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.conn
Class GenericStatementContext

java.lang.Objectorg.apache.derby.iapi.services.context.ContextImpl
org.apache.derby.impl.sql.conn.GenericStatementContext
- All Implemented Interfaces:
- org.apache.derby.iapi.services.context.Context, org.apache.derby.iapi.sql.conn.StatementContext
- final class GenericStatementContext
- extends org.apache.derby.iapi.services.context.ContextImpl
- implements org.apache.derby.iapi.sql.conn.StatementContext
- extends org.apache.derby.iapi.services.context.ContextImpl
GenericStatementContext is pushed/popped around a statement prepare and execute so that any statement specific clean up can be performed.
| Field Summary | |
private java.util.ArrayList |
dependencies
|
private java.lang.String |
internalSavePointName
|
private boolean |
inUse
|
private boolean |
isAtomic
|
private boolean |
isSystemCode
|
private org.apache.derby.iapi.sql.conn.LanguageConnectionContext |
lcc
|
private org.apache.derby.iapi.sql.execute.NoPutResultSet[] |
materializedSubqueries
|
private boolean |
parentInTrigger
|
private org.apache.derby.iapi.sql.ParameterValueSet |
pvs
|
private boolean |
rollbackParentContext
|
private boolean |
setSavePoint
|
private short |
sqlAllowed
Set to one of RoutineAliasInfo.{MODIFIES_SQL_DATA, READS_SQL_DATA, CONTAINS_SQL, NO_SQL} |
private java.lang.String |
stmtText
|
private org.apache.derby.iapi.sql.execute.NoPutResultSet[] |
subqueryTrackingArray
|
private org.apache.derby.iapi.store.access.TransactionController |
tc
|
private org.apache.derby.iapi.sql.ResultSet |
topResultSet
|
| Fields inherited from class org.apache.derby.iapi.services.context.ContextImpl |
|
| Constructor Summary | |
(package private) |
GenericStatementContext(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
org.apache.derby.iapi.store.access.TransactionController tc)
|
| Method Summary | |
void |
addDependency(org.apache.derby.iapi.sql.depend.Dependency dy)
Track a Dependency within this StatementContext. |
java.lang.StringBuffer |
appendErrorInfo()
|
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. |
short |
getSQLAllowed()
Get the setting of the SQL allowed state. |
java.lang.String |
getStatementText()
Return the text of the current statement. |
org.apache.derby.iapi.sql.execute.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 |
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 |
setInUse(boolean parentInTrigger,
boolean isAtomic,
java.lang.String stmtText,
org.apache.derby.iapi.sql.ParameterValueSet pvs)
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 |
setSubqueryResultSet(int subqueryNumber,
org.apache.derby.iapi.sql.execute.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(org.apache.derby.iapi.sql.ResultSet topResultSet,
org.apache.derby.iapi.sql.execute.NoPutResultSet[] subqueryTrackingArray)
Set the top ResultSet in the ResultSet tree for close down on an error. |
private void |
stuffTopResultSet(org.apache.derby.iapi.sql.ResultSet topResultSet,
org.apache.derby.iapi.sql.execute.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 |
tc
private final org.apache.derby.iapi.store.access.TransactionController tc
setSavePoint
private boolean setSavePoint
internalSavePointName
private java.lang.String internalSavePointName
topResultSet
private org.apache.derby.iapi.sql.ResultSet topResultSet
dependencies
private java.util.ArrayList dependencies
subqueryTrackingArray
private org.apache.derby.iapi.sql.execute.NoPutResultSet[] subqueryTrackingArray
materializedSubqueries
private org.apache.derby.iapi.sql.execute.NoPutResultSet[] materializedSubqueries
lcc
private final org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc
inUse
private boolean inUse
parentInTrigger
private boolean parentInTrigger
isAtomic
private boolean isAtomic
isSystemCode
private boolean isSystemCode
rollbackParentContext
private boolean rollbackParentContext
stmtText
private java.lang.String stmtText
pvs
private org.apache.derby.iapi.sql.ParameterValueSet pvs
sqlAllowed
private short sqlAllowed
- Set to one of RoutineAliasInfo.{MODIFIES_SQL_DATA, READS_SQL_DATA, CONTAINS_SQL, NO_SQL}
| Constructor Detail |
GenericStatementContext
GenericStatementContext(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc, org.apache.derby.iapi.store.access.TransactionController tc)
| Method Detail |
setInUse
public void setInUse(boolean parentInTrigger,
boolean isAtomic,
java.lang.String stmtText,
org.apache.derby.iapi.sql.ParameterValueSet pvs)
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - Mark this context as being in use.
- Specified by:
setInUsein interfaceorg.apache.derby.iapi.sql.conn.StatementContext
clearInUse
public void clearInUse()
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - 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.
- Specified by:
clearInUsein interfaceorg.apache.derby.iapi.sql.conn.StatementContext
setSavePoint
public void setSavePoint()
throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - 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.
- Specified by:
setSavePointin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
resetSavePoint
public void resetSavePoint()
throws org.apache.derby.iapi.error.StandardException
- Resets the savepoint to the current spot if it is
set, otherwise, noop. Used when a commit is
done on a nested connection.
- Specified by:
resetSavePointin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
clearSavePoint
public void clearSavePoint()
throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - Clear the save point for the current statement.
- Specified by:
clearSavePointin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
setTopResultSet
public void setTopResultSet(org.apache.derby.iapi.sql.ResultSet topResultSet, org.apache.derby.iapi.sql.execute.NoPutResultSet[] subqueryTrackingArray) throws org.apache.derby.iapi.error.StandardException
- Set the top ResultSet in the ResultSet tree for close down on
an error.
- Specified by:
setTopResultSetin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
stuffTopResultSet
private void stuffTopResultSet(org.apache.derby.iapi.sql.ResultSet topResultSet, org.apache.derby.iapi.sql.execute.NoPutResultSet[] subqueryTrackingArray)
- Private minion of setTopResultSet() and clearInUse()
setSubqueryResultSet
public void setSubqueryResultSet(int subqueryNumber,
org.apache.derby.iapi.sql.execute.NoPutResultSet subqueryResultSet,
int numSubqueries)
throws org.apache.derby.iapi.error.StandardException
- Set the appropriate entry in the subquery tracking array for
the specified subquery.
Useful for closing down open subqueries on an exception.
- Specified by:
setSubqueryResultSetin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
getSubqueryTrackingArray
public org.apache.derby.iapi.sql.execute.NoPutResultSet[] getSubqueryTrackingArray() throws org.apache.derby.iapi.error.StandardException
- Get the subquery tracking array for this query.
(Useful for runtime statistics.)
- Specified by:
getSubqueryTrackingArrayin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
addDependency
public void addDependency(org.apache.derby.iapi.sql.depend.Dependency dy) throws org.apache.derby.iapi.error.StandardException
- Track a Dependency within this StatementContext.
(We need to clear any dependencies added within this
context on an error.
- Specified by:
addDependencyin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
inTrigger
public boolean inTrigger()
- Returns whether we started from within the context of a trigger
or not.
- Specified by:
inTriggerin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
cleanupOnError
public void cleanupOnError(java.lang.Throwable error) throws org.apache.derby.iapi.error.StandardException
- Close down the top ResultSet, if relevant, and rollback to the
internal savepoint, if one was set.
- Specified by:
cleanupOnErrorin interfaceorg.apache.derby.iapi.services.context.Context
isLastHandler
public boolean isLastHandler(int severity)
- Description copied from interface:
org.apache.derby.iapi.services.context.Context - 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.
- Specified by:
isLastHandlerin interfaceorg.apache.derby.iapi.services.context.Context
onStack
public boolean onStack()
- Reports whether this StatementContext is on the context stack.
- Specified by:
onStackin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
isAtomic
public 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.
- Specified by:
isAtomicin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
getStatementText
public java.lang.String 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.
- Specified by:
getStatementTextin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
pleaseBeOnStack
private void pleaseBeOnStack()
throws org.apache.derby.iapi.error.StandardException
- Raise an exception if this Context is not in use, that is, on the
Context Stack.
inUse
public boolean inUse()
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - Is this statement context in use or not.
- Specified by:
inUsein interfaceorg.apache.derby.iapi.sql.conn.StatementContext
setSQLAllowed
public void setSQLAllowed(short allow,
boolean force)
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - 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}
- Specified by:
setSQLAllowedin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
getSQLAllowed
public short getSQLAllowed()
- Description copied from interface:
org.apache.derby.iapi.sql.conn.StatementContext - Get the setting of the SQL allowed state.
- Specified by:
getSQLAllowedin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
setParentRollback
public 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.
- Specified by:
setParentRollbackin interfaceorg.apache.derby.iapi.sql.conn.StatementContext
setSystemCode
public void setSystemCode()
- Set to indicate statement is system code.
For example a system procedure, view, function etc.
- Specified by:
setSystemCodein interfaceorg.apache.derby.iapi.sql.conn.StatementContext
getSystemCode
public boolean getSystemCode()
- Return true if this statement is system code.
- Specified by:
getSystemCodein interfaceorg.apache.derby.iapi.sql.conn.StatementContext
appendErrorInfo
public java.lang.StringBuffer appendErrorInfo()
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ conn overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC