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

public abstract Class StatementNode

extends QueryTreeNode
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.compile.TransactionStatementNode, org.apache.derby.impl.sql.compile.DDLStatementNode, org.apache.derby.impl.sql.compile.DMLStatementNode, org.apache.derby.impl.sql.compile.ExecSPSNode, org.apache.derby.impl.sql.compile.MiscellaneousStatementNode, org.apache.derby.impl.sql.compile.NOPStatementNode
Imports
java.lang.reflect.Modifier, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, .SQLState, org.apache.derby.iapi.services.compiler.MethodBuilder, 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.dictionary.DataDictionary, .TableDescriptor, org.apache.derby.iapi.store.access.ConglomerateController, .TransactionController, org.apache.derby.iapi.util.ByteArray

A StatementNode represents a single statement in the language. It is the top node for any statement.

StatementNode controls the class generation for query tree nodes.

Field Summary

Modifier and TypeField and Description
pack-priv static final TableDescriptor[]
EMPTY_TD_LIST

Cached empty list object.

pack-priv static final int
pack-priv static final int
NEED_DDL_ACTIVATION

create the outer shell class builder for the class we will be generating, generate the expression to stuff in it, and turn it into a class.

pack-priv static final int
pack-priv static final int
pack-priv static final int
Inherited from org.apache.derby.impl.sql.compile.QueryTreeNode:
AUTOINCREMENT_CREATE_MODIFYAUTOINCREMENT_CYCLEAUTOINCREMENT_INC_INDEXAUTOINCREMENT_IS_AUTOINCREMENT_INDEXAUTOINCREMENT_START_INDEX

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract int
public void
bindStatement()

Perform the binding operation statement.

public String

Returns:

String schema for EXECUTE STATEMENT null for all others
executeSchemaName
()

Returns name of schema in EXECUTE STATEMENT command.

public String

Returns:

String null unless overridden for Execute Statement command
executeStatementName
()

Returns the name of statement in EXECUTE STATEMENT command.

public GeneratedClass

Returns:

A GeneratedClass for this statement
generate
(ByteArray
the generated byte code for this statement. if non-null, then the byte code is saved here.
byteCode
)

Do code generation for this statement.

public Object
getCursorInfo()

Get an object with information about the cursor if there is one.

public String

Returns:

the name of the underlying sps
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.QueryTreeNode.isAtomic.

By default, assume StatementNodes are atomic.

protected TableDescriptor
public ResultDescription

Returns:

null
makeResultDescription
()

Only DML statements have result descriptions - for all others return null.

public boolean

Returns:

boolean Whether or not this Statement requires a set/clear savepoint
needsSavepoint
()

Returns whether or not this Statement requires a set/clear savepoint around its execution.

public void
optimizeStatement()

Generates an optimized statement from a bound StatementNode.

pack-priv abstract String
public String

Returns:

This object as a String
toString
()

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

Convert this object to a String.

public TableDescriptor[]

Returns:

A list of table descriptors (potentially empty).
updateIndexStatisticsFor
()

Returns a list of base tables for which the index statistics of the associated indexes should be updated.

Inherited from org.apache.derby.impl.sql.compile.QueryTreeNode:
acceptacceptChildrenaddTagaddUDTUsagePrivaddUDTUsagePrivbindOffsetFetchbindRowMultiSetbindUserCatalogTypebindUserTypecheckReliabilitycheckReliabilityconvertDefaultNodecopyTagsFromcreateTypeDependencydebugFlushdebugPrintdisablePrivilegeCollectionformatNodeStringgenerategenerateAuthorizeCheckgetBeginOffsetgetClassFactorygetCompilerContextgetContextgetContextManagergetDataDictionarygetDependencyManagergetEndOffsetgetExecutionFactorygetGenericConstantActionFactorygetIntPropertygetLanguageConnectionContextgetLongPropertygetNullNodegetOffsetOrderedNodesgetOptimizerFactorygetOptimizerTracergetParameterTypesgetSchemaDescriptorgetSchemaDescriptorgetStatementTypegetTableDescriptorgetTypeCompilergetUDTDescisPrivilegeCollectionRequiredisSessionSchemaisSessionSchemamakeConstantActionmakeTableNamemakeTableNamenodeHeaderoptimizerTracingIsOnorReliabilityparseSearchConditionparseStatementprintLabelprintSubNodesreferencesSessionSchemaresolveTableToSynonymsetBeginOffsetsetEndOffsetsetRefActionInfostackPrinttaggedWithtreePrinttreePrintverifyClassExist

Field Detail

EMPTY_TD_LISTback to summary
pack-priv static final TableDescriptor[] EMPTY_TD_LIST

Cached empty list object.

NEED_CURSOR_ACTIVATIONback to summary
pack-priv static final int NEED_CURSOR_ACTIVATION
NEED_DDL_ACTIVATIONback to summary
pack-priv static final int NEED_DDL_ACTIVATION

create the outer shell class builder for the class we will be generating, generate the expression to stuff in it, and turn it into a class.

NEED_NOTHING_ACTIVATIONback to summary
pack-priv static final int NEED_NOTHING_ACTIVATION
NEED_PARAM_ACTIVATIONback to summary
pack-priv static final int NEED_PARAM_ACTIVATION
NEED_ROW_ACTIVATIONback to summary
pack-priv static final int NEED_ROW_ACTIVATION

Constructor Detail

StatementNodeback to summary
pack-priv StatementNode(ContextManager cm)

Method Detail

activationKindback to summary
pack-priv abstract int activationKind()
bindStatementback to summary
public void bindStatement() throws StandardException

Perform the binding operation statement. Binding consists of permissions checking, view resolution, datatype resolution, and creation of a dependency list (for determining whether a tree or plan is still up to date). This bindStatement() method does nothing. Each StatementNode type that can appear at the top of a tree can override this method with its own bindStatement() method that does "something".

Exceptions
StandardException:
Thrown on error
executeSchemaNameback to summary
public String 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

executeStatementNameback to summary
public String 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

generateback to summary
public GeneratedClass generate(ByteArray byteCode) throws StandardException

Do code generation for this statement.

Parameters
byteCode:ByteArray

the generated byte code for this statement. if non-null, then the byte code is saved here.

Returns:GeneratedClass

A GeneratedClass for this statement

Exceptions
StandardException:
Thrown on error
getCursorInfoback to summary
public Object getCursorInfo() throws StandardException

Get an object with information about the cursor if there is one.

getSPSNameback to summary
public String 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

isAtomicback to summary
public boolean isAtomic() throws StandardException

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

By default, assume StatementNodes are atomic. The rare statements that aren't atomic (e.g. CALL method()) override this.

Returns:boolean

true if the statement is atomic

Annotations
@Override
Exceptions
StandardException:
Thrown on error
lockTableForCompilationback to summary
protected TableDescriptor lockTableForCompilation(TableDescriptor td) throws StandardException
makeResultDescriptionback to summary
public ResultDescription makeResultDescription()

Only DML statements have result descriptions - for all others return null. This method is overridden in DMLStatementNode.

Returns:ResultDescription

null

needsSavepointback to summary
public boolean needsSavepoint()

Returns whether or not this Statement requires a set/clear savepoint around its execution. The following statement "types" do not require them: Cursor - unnecessary and won't work in a read only environment Xact - savepoint will get blown away underneath us during commit/rollback

ONLY CALLABLE AFTER GENERATION

This implementation returns true, sub-classes can override the method to not require a savepoint.

Returns:boolean

boolean Whether or not this Statement requires a set/clear savepoint

optimizeStatementback to summary
public void optimizeStatement() throws StandardException

Generates an optimized statement from a bound StatementNode. Actually, it annotates the tree in place rather than generating a new tree. For non-optimizable statements (for example, CREATE TABLE), return the bound tree without doing anything. For optimizable statements, this method will be over-ridden in the statement's root node (DMLStatementNode in all cases we know about so far). Throws an exception if the tree is not bound, or if the binding is out of date.

Exceptions
StandardException:
Thrown on error
statementToStringback to summary
pack-priv abstract String statementToString()
toStringback to summary
public String toString()

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

Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Returns:String

This object as a String

Annotations
@Override
updateIndexStatisticsForback to summary
public TableDescriptor[] updateIndexStatisticsFor() throws StandardException

Returns a list of base tables for which the index statistics of the associated indexes should be updated.

This default implementation always returns an empty list.

Returns:TableDescriptor[]

A list of table descriptors (potentially empty).

Exceptions
StandardException:
if accessing the index descriptors of a base table fails