Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class ExecSPSNode

extends StatementNode
Class Inheritance
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.loader.GeneratedClass, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.ResultDescription, org.apache.derby.iapi.sql.compile.Visitor, org.apache.derby.iapi.sql.dictionary.DataDictionary, .SPSDescriptor, .SchemaDescriptor, org.apache.derby.iapi.sql.execute.ConstantAction, .ExecPreparedStatement, org.apache.derby.iapi.types.DataTypeDescriptor, org.apache.derby.iapi.util.ByteArray

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

Modifier and TypeField and Description
private TableName
private ExecPreparedStatement
private SPSDescriptor
Inherited from org.apache.derby.impl.sql.compile.StatementNode:
EMPTY_TD_LISTNEED_CURSOR_ACTIVATIONNEED_DDL_ACTIVATIONNEED_NOTHING_ACTIVATIONNEED_PARAM_ACTIVATIONNEED_ROW_ACTIVATION

Constructor Summary

AccessConstructor and Description
pack-priv
ExecSPSNode(TableName
The name of the table to be created
newObjectName
,
ContextManager
The context manager
cm
)

Constructor for a ExecSPSNode

Method Summary

Modifier and TypeMethod and Description
pack-priv void
acceptChildren(Visitor
the visitor
v
)

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.acceptChildren.

Accept a visitor on all child nodes.

pack-priv int
public void
public String
executeSchemaName()

Overrides org.apache.derby.impl.sql.compile.StatementNode.executeSchemaName.

Returns name of schema in EXECUTE STATEMENT command.

public String
executeStatementName()

Overrides org.apache.derby.impl.sql.compile.StatementNode.executeStatementName.

Returns the name of statement in EXECUTE STATEMENT command.

public GeneratedClass

Returns:

A GeneratedClass for this statement
generate
(ByteArray
- ignored (he he)
ignored
)

Overrides org.apache.derby.impl.sql.compile.StatementNode.generate.

Do code generation for this statement.

public Object

Returns:

the cursor info
getCursorInfo
()

Overrides org.apache.derby.impl.sql.compile.StatementNode.getCursorInfo.

Get information about this cursor.

public DataTypeDescriptor[]

Returns:

An array of DataTypeDescriptors describing the ? parameters for this statement. It returns null if there are no parameters.
getParameterTypes
()

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.getParameterTypes.

Return a description of the ?

public String

Returns:

the name of the underlying sps
getSPSName
()

Overrides org.apache.derby.impl.sql.compile.StatementNode.getSPSName.

Get the name of the SPS that is used to execute this statement.

public boolean

Returns:

true if the statement is atomic
isAtomic
()

Overrides org.apache.derby.impl.sql.compile.StatementNode.isAtomic.

SPSes are atomic if its underlying statement is atomic.

public ConstantAction
makeConstantAction()

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.makeConstantAction.

Create the Constant information that will drive the guts of Execution.

public ResultDescription

Returns:

the description
makeResultDescription
()

Overrides org.apache.derby.impl.sql.compile.StatementNode.makeResultDescription.

Make the result description.

public boolean

Returns:

boolean always true.
needsSavepoint
()

Overrides org.apache.derby.impl.sql.compile.StatementNode.needsSavepoint.

We need a savepoint if we will do transactional work.

pack-priv String
Inherited from org.apache.derby.impl.sql.compile.StatementNode:
lockTableForCompilationoptimizeStatementtoStringupdateIndexStatisticsFor

Field Detail

nameback to summary
private TableName name
psback to summary
private ExecPreparedStatement ps
spsdback to summary
private SPSDescriptor spsd

Constructor Detail

ExecSPSNodeback to summary
pack-priv ExecSPSNode(TableName newObjectName, ContextManager cm)

Constructor for a ExecSPSNode

Parameters
newObjectName:TableName

The name of the table to be created

cm:ContextManager

The context manager

Exceptions
StandardException:
Thrown on error

Method Detail

acceptChildrenback to summary
pack-priv void acceptChildren(Visitor v) throws StandardException

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.acceptChildren.

Doc from org.apache.derby.impl.sql.compile.QueryTreeNode.acceptChildren.

Accept a visitor on all child nodes. All sub-classes that add fields that should be visited, should override this method and call accept(v) on all visitable fields, as well as super.acceptChildren(v) to make sure all visitable fields defined by the super-class are accepted too.

Parameters
v:Visitor

the visitor

Annotations
@Override
Exceptions
StandardException:
on errors raised by the visitor
activationKindback to summary
pack-priv int activationKind()

Implements abstract org.apache.derby.impl.sql.compile.StatementNode.activationKind.

bindStatementback to summary
public void bindStatement() throws StandardException

Overrides org.apache.derby.impl.sql.compile.StatementNode.bindStatement.

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.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
executeSchemaNameback to summary
public String executeSchemaName()

Overrides org.apache.derby.impl.sql.compile.StatementNode.executeSchemaName.

Doc from org.apache.derby.impl.sql.compile.StatementNode.executeSchemaName.

Returns name of schema in EXECUTE STATEMENT command. Returns null for all other commands.

Returns:String

String schema for EXECUTE STATEMENT null for all others

Annotations
@Override
See Also
StatementNode#executeSchemaName
executeStatementNameback to summary
public String executeStatementName()

Overrides org.apache.derby.impl.sql.compile.StatementNode.executeStatementName.

Doc from org.apache.derby.impl.sql.compile.StatementNode.executeStatementName.

Returns the name of statement in EXECUTE STATEMENT command. Returns null for all other commands.

Returns:String

String null unless overridden for Execute Statement command

Annotations
@Override
See Also
StatementNode#executeStatementName
generateback to summary
public GeneratedClass generate(ByteArray ignored) throws StandardException

Overrides org.apache.derby.impl.sql.compile.StatementNode.generate.

Do code generation for this statement. Overrides the normal generation path in StatementNode.

Parameters
ignored:ByteArray

- ignored (he he)

Returns:GeneratedClass

A GeneratedClass for this statement

Annotations
@Override
Exceptions
StandardException:
Thrown on error
getCursorInfoback to summary
public Object getCursorInfo()

Overrides org.apache.derby.impl.sql.compile.StatementNode.getCursorInfo.

Get information about this cursor. For sps, this is info saved off of the original query tree (the one for the underlying query).

Returns:Object

the cursor info

Annotations
@Override
getParameterTypesback to summary
public DataTypeDescriptor[] getParameterTypes() throws StandardException

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.getParameterTypes.

Return a description of the ? parameters for the statement represented by this query tree. Just return the params stored with the prepared statement.

Returns:DataTypeDescriptor[]

An array of DataTypeDescriptors describing the ? parameters for this statement. It returns null if there are no parameters.

Annotations
@Override
Exceptions
StandardException:
on error
getSPSNameback to summary
public String getSPSName()

Overrides org.apache.derby.impl.sql.compile.StatementNode.getSPSName.

Get the name of the SPS that is used to execute this statement. Only relevant for an ExecSPSNode -- otherwise, returns null.

Returns:String

the name of the underlying sps

Annotations
@Override
isAtomicback to summary
public boolean isAtomic()

Overrides org.apache.derby.impl.sql.compile.StatementNode.isAtomic.

SPSes are atomic if its underlying statement is atomic.

Returns:boolean

true if the statement is atomic

Annotations
@Override
makeConstantActionback to summary
public ConstantAction makeConstantAction()

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.makeConstantAction.

Create the Constant information that will drive the guts of Execution. This is assumed to be the first action on this node.

Annotations
@Override
makeResultDescriptionback to summary
public ResultDescription makeResultDescription()

Overrides org.apache.derby.impl.sql.compile.StatementNode.makeResultDescription.

Make the result description. Really, we are just copying it from the stored prepared statement.

Returns:ResultDescription

the description

Annotations
@Override
needsSavepointback to summary
public boolean needsSavepoint()

Overrides org.apache.derby.impl.sql.compile.StatementNode.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.

Returns:boolean

boolean always true.

Annotations
@Override
statementToStringback to summary
pack-priv String statementToString()

Implements abstract org.apache.derby.impl.sql.compile.StatementNode.statementToString.