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

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.DMLStatementNode
              extended byorg.apache.derby.impl.sql.compile.CallStatementNode
All Implemented Interfaces:
Visitable

public class CallStatementNode
extends DMLStatementNode

An CallStatementNode represents a CALL statement. It is the top node of the query tree for that statement. There are 2 flavors, class and object, of call statements. A class call statement is a static method call off of a class expression (class classnameandpath), while an object call statement is a method call off of an object expression. The return value, if any, from the underlying method call is ignored.

Author:
Jerry Brenner

Field Summary
private  java.util.Vector aggregateVector
           
private  ValueNode methodCall
           
private  java.lang.String methodName
           
private  SubqueryList subqueries
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode
resultSet
 
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
CallStatementNode()
           
 
Method Summary
 Visitable accept(Visitor v)
          Accept a visitor, and call v.visit() on child nodes as necessary.
 QueryTreeNode bind()
          Bind this UpdateNode.
 void generate(ActivationClassBuilder acb, MethodBuilder mb)
          Code generation for CallStatementNode.
 MethodCallNode getMethodCallNode()
          Get the method call node.
 void init(java.lang.Object methodName, java.lang.Object methodCall)
          Initializer for a CallStatementNode.
 ResultDescription makeResultDescription()
          Make a ResultDescription for use in a PreparedStatement.
 QueryTreeNode optimize()
          Optimize a DML statement (which is the only type of statement that should need optimizing, I think).
 void printSubNodes(int depth)
          Prints the sub-nodes of this object.
 java.lang.String statementToString()
           
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterHolders, generateParameterValueSet, getResultSetNode, init, isAtomic
 
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
generate, lockTableForCompilation
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, needsSavepoint, nodeHeader, parseQueryText, printLabel, 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

methodName

private java.lang.String methodName

methodCall

private ValueNode methodCall

subqueries

private SubqueryList subqueries

aggregateVector

private java.util.Vector aggregateVector
Constructor Detail

CallStatementNode

public CallStatementNode()
Method Detail

init

public void init(java.lang.Object methodName,
                 java.lang.Object methodCall)
          throws StandardException
Initializer for a CallStatementNode.

Overrides:
init in class QueryTreeNode
Parameters:
methodName - The method name
methodCall - The expression to "call"
Throws:
StandardException - Thrown on error

toString

public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Overrides:
toString in class StatementNode
Returns:
This object as a String

statementToString

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

printSubNodes

public void printSubNodes(int depth)
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Overrides:
printSubNodes in class DMLStatementNode
Parameters:
depth - The depth of this node in the tree
Returns:
Nothing

bind

public QueryTreeNode bind()
                   throws StandardException
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.

Overrides:
bind in class QueryTreeNode
Returns:
The bound query tree
Throws:
StandardException - Thrown on error

optimize

public QueryTreeNode optimize()
                       throws StandardException
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.

Overrides:
optimize in class DMLStatementNode
Returns:
An optimized QueryTree
Throws:
StandardException - Thrown on error

generate

public void generate(ActivationClassBuilder acb,
                     MethodBuilder mb)
              throws StandardException
Code generation for CallStatementNode. The generated code will contain: o A generated void method for the user's method call.

Overrides:
generate in class QueryTreeNode
Parameters:
acb - The ActivationClassBuilder for the class being built
mb - The method for the execute() method to be built
Returns:
A compiled Expression returning a ResultSet for the call statement.
Throws:
StandardException - Thrown on error

makeResultDescription

public ResultDescription makeResultDescription()
Description copied from class: DMLStatementNode
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.

Overrides:
makeResultDescription in class DMLStatementNode
Returns:
A ResultDescription for this DML statement

accept

public Visitable accept(Visitor v)
                 throws StandardException
Accept a visitor, and call v.visit() on child nodes as necessary.

Specified by:
accept in interface Visitable
Overrides:
accept in class DMLStatementNode
Parameters:
v - the visitor
Throws:
StandardException - on error

getMethodCallNode

public MethodCallNode getMethodCallNode()
Get the method call node.

Returns:
the method call node.

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.