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

pack-priv Class CallStatementNode

extends DMLStatementNode
Class Inheritance
Imports
java.lang.reflect.Modifier, org.apache.derby.catalog.types.RoutineAliasInfo, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, .SQLState, org.apache.derby.iapi.services.classfile.VMOpcode, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.ResultDescription, org.apache.derby.iapi.sql.compile.CompilerContext, .Visitor, org.apache.derby.iapi.sql.conn.Authorizer, org.apache.derby.iapi.sql.dictionary.DataDictionary

An CallStatementNode represents a CALL statement. It is the top node of the query tree for that statement. A procedure call is very simple. CALL [.]() are either constants or parameter markers. This implementation assumes that no subqueries or aggregates can be in the argument list. A procedure is always represented by a MethodCallNode.

Field Summary

Modifier and TypeField and Description
private JavaToSQLValueNode
methodCall

The method call for the Java procedure.

Inherited from org.apache.derby.impl.sql.compile.DMLStatementNode:
resultSet

Constructor Summary

AccessConstructor and Description
pack-priv
CallStatementNode(JavaToSQLValueNode
The expression to "call"
methodCall
,
ContextManager
The context manager
cm
)

Constructor for a CallStatementNode.

Method Summary

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

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

Accept the visitor for all visitable children of this node.

public void
private void
checkReliability()

This method checks if the called procedure allows modification of SQL data.

pack-priv void
generate(ActivationClassBuilder
The ActivationClassBuilder for the class being built
acb
,
MethodBuilder
The method for the execute() method to be built
mb
)

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

Code generation for CallStatementNode.

pack-priv int
getPrivType()

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.getPrivType.

Set default privilege of EXECUTE for this node.

private short

Returns:

SQL allowed by the procedure
getSQLAllowedInProcedure
()

This method checks the SQL allowed by the called procedure.

public ResultDescription
makeResultDescription()

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

Make a ResultDescription for use in a PreparedStatement.

public void
optimizeStatement()

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement.

Optimize a DML statement (which is the only type of statement that should need optimizing, I think).

pack-priv void
printSubNodes(int
The depth of this node in the tree
depth
)

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.printSubNodes.

Prints the sub-nodes of this object.

pack-priv String
Inherited from org.apache.derby.impl.sql.compile.DMLStatementNode:
activationKindbindbindExpressionsbindExpressionsWithTablesbindResultSetsWithTablesbindTablesgenerateParameterValueSetgetResultSetNodeisAtomic

Field Detail

methodCallback to summary
private JavaToSQLValueNode methodCall

The method call for the Java procedure. Guaranteed to be a JavaToSQLValueNode wrapping a MethodCallNode by checks in the parser.

Constructor Detail

CallStatementNodeback to summary
pack-priv CallStatementNode(JavaToSQLValueNode methodCall, ContextManager cm)

Constructor for a CallStatementNode.

Parameters
methodCall:JavaToSQLValueNode

The expression to "call"

cm:ContextManager

The context manager

Method Detail

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

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

Accept the visitor for all visitable children of this node.

Parameters
v:Visitor

the visitor

Annotations
@Override
Exceptions
StandardException:
on error
bindStatementback to summary
public void bindStatement() throws StandardException

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

Bind this UpdateNode. This means looking up tables and columns and getting their types, and figuring out the result types of all expressions, as well as doing view resolution, permissions checking, etc.

Binding an update will also massage the tree so that the ResultSetNode has a single column, the RID.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
checkReliabilityback to summary
private void checkReliability() throws StandardException

This method checks if the called procedure allows modification of SQL data. If yes, it cannot be compiled if the reliability is CompilerContext.MODIFIES_SQL_DATA_PROCEDURE_ILLEGAL. This reliability is set for BEFORE triggers in the create trigger node. This check thus disallows creation of BEFORE triggers which contain calls to procedures that modify SQL data in the trigger action statement.

generateback to summary
pack-priv void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException

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

Code generation for CallStatementNode. The generated code will contain: o A generated void method for the user's method call.

Parameters
acb:ActivationClassBuilder

The ActivationClassBuilder for the class being built

mb:MethodBuilder

The method for the execute() method to be built

Annotations
@Override
Exceptions
StandardException:
Thrown on error
getPrivTypeback to summary
pack-priv int getPrivType()

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.getPrivType.

Set default privilege of EXECUTE for this node.

Returns:int

Doc from org.apache.derby.impl.sql.compile.DMLStatementNode.getPrivType.

true if the statement is atomic

Annotations
@Override
getSQLAllowedInProcedureback to summary
private short getSQLAllowedInProcedure()

This method checks the SQL allowed by the called procedure. This method should be called only after the procedure has been resolved.

Returns:short

SQL allowed by the procedure

makeResultDescriptionback to summary
public ResultDescription makeResultDescription()

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

Doc from org.apache.derby.impl.sql.compile.DMLStatementNode.makeResultDescription.

Make a ResultDescription for use in a PreparedStatement. ResultDescriptions are visible to JDBC only for cursor statements. For other types of statements, they are only used internally to get descriptions of the base tables being affected. For example, for an INSERT statement, the ResultDescription describes the rows in the table being inserted into, which is useful when the values being inserted are of a different type or length than the columns in the base table.

Returns:ResultDescription

A ResultDescription for this DML statement

Annotations
@Override
optimizeStatementback to summary
public void optimizeStatement() throws StandardException

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement.

Optimize a DML statement (which is the only type of statement that should need optimizing, I think). This method over-rides the one in QueryTreeNode. This method takes a bound tree, and returns an optimized tree. It annotates the bound tree rather than creating an entirely new tree. Throws an exception if the tree is not bound, or if the binding is out of date.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
printSubNodesback to summary
pack-priv void printSubNodes(int depth)

Overrides org.apache.derby.impl.sql.compile.DMLStatementNode.printSubNodes.

Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Parameters
depth:int

The depth of this node in the tree

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

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