org.apache.derby.iapi.sql.conn
Interface StatementContext

All Superinterfaces:
Context
All Known Implementing Classes:
GenericStatementContext

public interface StatementContext
extends Context

StatementContext keeps the context for a statement.


Method Summary
 void addDependency(Dependency dy)
          Track a Dependency within this StatementContext.
 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.
 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 onStack()
          Reports whether this StatementContext is on the context stack.
 void resetSavePoint()
          If this statement context has a savepoint, then it is reset to the current point.
 void setInUse(boolean inTrigger, boolean isAtomic, java.lang.String stmtText, 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, 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.
 
Methods inherited from interface org.apache.derby.iapi.services.context.Context
cleanupOnError, getContextManager, getIdName, isLastHandler, popMe, pushMe
 

Method Detail

setInUse

public void setInUse(boolean inTrigger,
                     boolean isAtomic,
                     java.lang.String stmtText,
                     ParameterValueSet pvs)
Mark this context as being in use.

Parameters:
isAtomic - true if the statement must be executed atomically
stmtText - 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 one

clearInUse

public void 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.


setSavePoint

public void setSavePoint()
                  throws StandardException
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.

Throws:
StandardException - Thrown on error

resetSavePoint

public void resetSavePoint()
                    throws StandardException
If this statement context has a savepoint, then it is reset to the current point. Otherwise, it is a noop.

Throws:
StandardException - Thrown on error

clearSavePoint

public void clearSavePoint()
                    throws StandardException
Clear the save point for the current statement.

Throws:
StandardException - Thrown on error

setTopResultSet

public void setTopResultSet(ResultSet topResultSet,
                            NoPutResultSet[] subqueryTrackingArray)
                     throws StandardException
Set the top ResultSet in the ResultSet tree for close down on an error.

Parameters:
topResultSet - The top ResultSet in the ResultSet tree
subqueryTrackingArray - (Sparse) of tops of subquery ResultSet trees
Returns:
Nothing.
Throws:
StandardException - Thrown on error

setSubqueryResultSet

public void setSubqueryResultSet(int subqueryNumber,
                                 NoPutResultSet subqueryResultSet,
                                 int numSubqueries)
                          throws StandardException
Set the appropriate entry in the subquery tracking array for the specified subquery. Useful for closing down open subqueries on an exception.

Parameters:
subqueryNumber - The subquery # for this subquery
subqueryResultSet - The NoPutResultSet at the top of the subquery
numSubqueries - The total # of subqueries in the entire query
Returns:
Nothing.
Throws:
StandardException - Thrown on error

getSubqueryTrackingArray

public NoPutResultSet[] getSubqueryTrackingArray()
                                          throws StandardException
Get the subquery tracking array for this query. (Useful for runtime statistics.)

Returns:
NoPutResultSet[] The (sparse) array of tops of subquery ResultSet trees
Throws:
StandardException - Thrown on error

addDependency

public void addDependency(Dependency dy)
                   throws StandardException
Track a Dependency within this StatementContext. (We need to clear any dependencies added within this context on an error.

Parameters:
dy - The dependency to track.
Returns:
Nothing.
Throws:
StandardException - Thrown on error

onStack

public boolean onStack()
Reports whether this StatementContext is on the context stack.

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

inTrigger

public boolean inTrigger()
Returns whether we started from within the context of a trigger or not.

Returns:
true if we are in a trigger context

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.

Returns:
true if needs to be atomic

inUse

public boolean inUse()
Is this statement context in use or not.

Returns:
true if in use

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) and setXXXX/getXXXX jdbc methods.

Returns:
the statement text

setSQLAllowed

public void setSQLAllowed(short allow,
                          boolean force)
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 - set to true to override more restrictive setting. Used to reset the permissions after a function call.

getSQLAllowed

public short getSQLAllowed()
Get the setting of the SQL allowed state.


setSystemCode

public void setSystemCode()
Set to indicate statement is system code. For example a system procedure, view, function etc.


getSystemCode

public boolean getSystemCode()
Return true if this statement is system code.


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.


Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.