org.apache.derby.impl.sql.compile
Class ExecSPSNode

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.StatementNode
          extended byorg.apache.derby.impl.sql.compile.ExecSPSNode
All Implemented Interfaces:
Visitable

public class ExecSPSNode
extends StatementNode

A ExecSPSNode is the root of a QueryTree that represents an EXECUTE STATEMENT statement. It is a tad abnormal. Duringa 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).

Author:
jamie

Field Summary
private  TableName name
           
private  ExecPreparedStatement ps
           
private  SPSDescriptor spsd
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode
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_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
ExecSPSNode()
           
 
Method Summary
(package private)  int activationKind()
           
 QueryTreeNode bind()
          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 ?
private  SPSDescriptor getSPSDescriptor()
           
 java.lang.String getSPSName()
          Get the name of the SPS that is used to execute this statement.
 void init(java.lang.Object newObjectName)
          Initializer for a ExecSPSNode
 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.
 java.lang.String statementToString()
           
 
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
lockTableForCompilation, toString
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, convertDefaultNode, debugFlush, debugPrint, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, isSessionSchema, isSessionSchema, makeTableName, nodeHeader, optimize, parseQueryText, printLabel, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private TableName name

spsd

private SPSDescriptor spsd

ps

private ExecPreparedStatement ps
Constructor Detail

ExecSPSNode

public ExecSPSNode()
Method Detail

init

public void init(java.lang.Object newObjectName)
Initializer for a ExecSPSNode

Overrides:
init in class QueryTreeNode
Parameters:
newObjectName - The name of the table to be created
Throws:
StandardException - Thrown on error

bind

public QueryTreeNode bind()
                   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:
bind in class QueryTreeNode
Returns:
The bound query tree
Throws:
StandardException - Thrown on error

isAtomic

public boolean isAtomic()
SPSes are atomic if its underlying statement is atomic.

Overrides:
isAtomic in class StatementNode
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 class StatementNode
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 class QueryTreeNode
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 class QueryTreeNode
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 class QueryTreeNode
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 class QueryTreeNode

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 class QueryTreeNode
Returns:
boolean always true.

executeStatementName

public java.lang.String executeStatementName()
Description copied from class: QueryTreeNode
Returns the name of statement in EXECUTE STATEMENT command. Returns null for all other commands.

Overrides:
executeStatementName in class QueryTreeNode
Returns:
String null unless overridden for Execute Statement command
See Also:
QueryTreeNode.executeStatementName()

executeSchemaName

public java.lang.String executeSchemaName()
Description copied from class: QueryTreeNode
Returns name of schema in EXECUTE STATEMENT command. Returns null for all other commands.

Overrides:
executeSchemaName in class QueryTreeNode
Returns:
String schema for EXECUTE STATEMENT null for all others
See Also:
QueryTreeNode.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 class QueryTreeNode
Returns:
the name of the underlying sps

activationKind

int activationKind()
Specified by:
activationKind in class StatementNode

statementToString

public java.lang.String statementToString()
Specified by:
statementToString in class StatementNode

getSPSDescriptor

private final SPSDescriptor getSPSDescriptor()

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

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