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 TableName
name
private ExecPreparedStatement
ps
private SPSDescriptor
spsd
-
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) void
acceptChildren(Visitor v)
Accept a visitor on all child nodes.(package private) int
activationKind()
void
bindStatement()
Bind this ExecSPSNode.java.lang.String
executeSchemaName()
Returns name of schema in EXECUTE STATEMENT command.java.lang.String
executeStatementName()
Returns the name of statement in EXECUTE STATEMENT command.GeneratedClass
generate(ByteArray ignored)
Do code generation for this statement.java.lang.Object
getCursorInfo()
Get information about this cursor.DataTypeDescriptor[]
getParameterTypes()
Return a description of the ?java.lang.String
getSPSName()
Get the name of the SPS that is used to execute this statement.boolean
isAtomic()
SPSes are atomic if its underlying statement is atomic.ConstantAction
makeConstantAction()
Create the Constant information that will drive the guts of Execution.ResultDescription
makeResultDescription()
Make the result description.boolean
needsSavepoint()
We need a savepoint if we will do transactional work.(package private) java.lang.String
statementToString()
-
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 StandardException
Bind 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:
bindStatement
in classStatementNode
- Throws:
StandardException
- Thrown on error
-
isAtomic
public boolean isAtomic()
SPSes are atomic if its underlying statement is atomic.- Overrides:
isAtomic
in 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:
generate
in 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:
makeResultDescription
in 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:
getCursorInfo
in 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:
getParameterTypes
in 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:
makeConstantAction
in 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:
needsSavepoint
in classStatementNode
- Returns:
- boolean always true.
-
executeStatementName
public java.lang.String executeStatementName()
Description copied from class:StatementNode
Returns the name of statement in EXECUTE STATEMENT command. Returns null for all other commands.- Overrides:
executeStatementName
in classStatementNode
- Returns:
- String null unless overridden for Execute Statement command
- See Also:
StatementNode.executeStatementName()
-
executeSchemaName
public java.lang.String executeSchemaName()
Description copied from class:StatementNode
Returns name of schema in EXECUTE STATEMENT command. Returns null for all other commands.- Overrides:
executeSchemaName
in 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:
getSPSName
in classStatementNode
- Returns:
- the name of the underlying sps
-
activationKind
int activationKind()
- Specified by:
activationKind
in classStatementNode
-
statementToString
java.lang.String statementToString()
- Specified by:
statementToString
in classStatementNode
-
acceptChildren
void acceptChildren(Visitor v) throws StandardException
Description copied from class:QueryTreeNode
Accept 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:
acceptChildren
in classQueryTreeNode
- Parameters:
v
- the visitor- Throws:
StandardException
- on errors raised by the visitor
-
-