Class ExecSPSNode
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.StatementNode
-
- org.apache.derby.impl.sql.compile.ExecSPSNode
-
- All Implemented Interfaces:
Visitable
class ExecSPSNode extends StatementNode
A ExecSPSNode is the root of a QueryTree that represents an EXECUTE STATEMENT statement. It is a tad abnormal. During a bind, it locates and retrieves the SPSDescriptor for the particular statement. At generate time, it generates the prepared statement for the stored prepared statement and returns it (i.e. it effectively replaces itself with the appropriate prepared statement).
-
-
Field Summary
Fields Modifier and Type Field Description private TableNamenameprivate ExecPreparedStatementpsprivate SPSDescriptorspsd-
Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode
EMPTY_TD_LIST, NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATION
-
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description ExecSPSNode(TableName newObjectName, ContextManager cm)Constructor for a ExecSPSNode
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidacceptChildren(Visitor v)Accept a visitor on all child nodes.(package private) intactivationKind()voidbindStatement()Bind this ExecSPSNode.java.lang.StringexecuteSchemaName()Returns name of schema in EXECUTE STATEMENT command.java.lang.StringexecuteStatementName()Returns the name of statement in EXECUTE STATEMENT command.GeneratedClassgenerate(ByteArray ignored)Do code generation for this statement.java.lang.ObjectgetCursorInfo()Get information about this cursor.DataTypeDescriptor[]getParameterTypes()Return a description of the ?java.lang.StringgetSPSName()Get the name of the SPS that is used to execute this statement.booleanisAtomic()SPSes are atomic if its underlying statement is atomic.ConstantActionmakeConstantAction()Create the Constant information that will drive the guts of Execution.ResultDescriptionmakeResultDescription()Make the result description.booleanneedsSavepoint()We need a savepoint if we will do transactional work.(package private) java.lang.StringstatementToString()-
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
lockTableForCompilation, optimizeStatement, toString, updateIndexStatisticsFor
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Field Detail
-
name
private TableName name
-
spsd
private SPSDescriptor spsd
-
ps
private ExecPreparedStatement ps
-
-
Constructor Detail
-
ExecSPSNode
ExecSPSNode(TableName newObjectName, ContextManager cm)
Constructor for a ExecSPSNode- Parameters:
newObjectName- The name of the table to be createdcm- The context manager- Throws:
StandardException- Thrown on error
-
-
Method Detail
-
bindStatement
public void bindStatement() throws StandardExceptionBind this ExecSPSNode. This means doing any static error checking that can be done before actually creating the table. For example, verifying that the ResultColumnList does not contain any duplicate column names.- Overrides:
bindStatementin classStatementNode- Throws:
StandardException- Thrown on error
-
isAtomic
public boolean isAtomic()
SPSes are atomic if its underlying statement is atomic.- Overrides:
isAtomicin classStatementNode- Returns:
- true if the statement is atomic
-
generate
public GeneratedClass generate(ByteArray ignored) throws StandardException
Do code generation for this statement. Overrides the normal generation path in StatementNode.- Overrides:
generatein classStatementNode- Parameters:
ignored- - ignored (he he)- Returns:
- A GeneratedClass for this statement
- Throws:
StandardException- Thrown on error
-
makeResultDescription
public ResultDescription makeResultDescription()
Make the result description. Really, we are just copying it from the stored prepared statement.- Overrides:
makeResultDescriptionin classStatementNode- Returns:
- the description
-
getCursorInfo
public java.lang.Object getCursorInfo()
Get information about this cursor. For sps, this is info saved off of the original query tree (the one for the underlying query).- Overrides:
getCursorInfoin classStatementNode- Returns:
- the cursor info
-
getParameterTypes
public DataTypeDescriptor[] getParameterTypes() throws StandardException
Return a description of the ? parameters for the statement represented by this query tree. Just return the params stored with the prepared statement.- Overrides:
getParameterTypesin classQueryTreeNode- Returns:
- An array of DataTypeDescriptors describing the ? parameters for this statement. It returns null if there are no parameters.
- Throws:
StandardException- on error
-
makeConstantAction
public ConstantAction makeConstantAction()
Create the Constant information that will drive the guts of Execution. This is assumed to be the first action on this node.- Overrides:
makeConstantActionin classQueryTreeNode
-
needsSavepoint
public boolean needsSavepoint()
We need a savepoint if we will do transactional work. We'll ask the underlying statement if it needs a savepoint and pass that back. We have to do this after generation because getting the PS now might cause us to basically do DDL (for a stmt recompilation) which is explicitly banned during binding. So the caller can only call this after generate() has retrieved the target PS.- Overrides:
needsSavepointin classStatementNode- Returns:
- boolean always true.
-
executeStatementName
public java.lang.String executeStatementName()
Description copied from class:StatementNodeReturns the name of statement in EXECUTE STATEMENT command. Returns null for all other commands.- Overrides:
executeStatementNamein classStatementNode- Returns:
- String null unless overridden for Execute Statement command
- See Also:
StatementNode.executeStatementName()
-
executeSchemaName
public java.lang.String executeSchemaName()
Description copied from class:StatementNodeReturns name of schema in EXECUTE STATEMENT command. Returns null for all other commands.- Overrides:
executeSchemaNamein classStatementNode- Returns:
- String schema for EXECUTE STATEMENT null for all others
- See Also:
StatementNode.executeSchemaName()
-
getSPSName
public java.lang.String getSPSName()
Get the name of the SPS that is used to execute this statement. Only relevant for an ExecSPSNode -- otherwise, returns null.- Overrides:
getSPSNamein classStatementNode- Returns:
- the name of the underlying sps
-
activationKind
int activationKind()
- Specified by:
activationKindin classStatementNode
-
statementToString
java.lang.String statementToString()
- Specified by:
statementToStringin classStatementNode
-
acceptChildren
void acceptChildren(Visitor v) throws StandardException
Description copied from class:QueryTreeNodeAccept a visitor on all child nodes. All sub-classes that add fields that should be visited, should override this method and callaccept(v)on all visitable fields, as well assuper.acceptChildren(v)to make sure all visitable fields defined by the super-class are accepted too.- Overrides:
acceptChildrenin classQueryTreeNode- Parameters:
v- the visitor- Throws:
StandardException- on errors raised by the visitor
-
-