org.apache.derby.impl.sql.compile
Class CallStatementNode
java.lang.Object
org.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.StatementNode
org.apache.derby.impl.sql.compile.DMLStatementNode
org.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.
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.
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
accept, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExist |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
methodCall
private JavaToSQLValueNode methodCall
- The method call for the Java procedure. Guaranteed to be
a JavaToSQLValueNode wrapping a MethodCallNode by checks
in the parser.
CallStatementNode
public CallStatementNode()
init
public void init(java.lang.Object methodCall)
- Initializer for a CallStatementNode.
- Overrides:
init
in class DMLStatementNode
- Parameters:
methodCall
- The expression to "call"
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
bindStatement
public void bindStatement()
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:
bindStatement
in class StatementNode
- Throws:
StandardException
- Thrown on error
optimizeStatement
public void optimizeStatement()
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:
optimizeStatement
in class DMLStatementNode
- 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 builtmb
- The method for the execute() method to be built
- 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
acceptChildren
void acceptChildren(Visitor v)
throws StandardException
- Accept the visitor for all visitable children of this node.
- Overrides:
acceptChildren
in class DMLStatementNode
- Parameters:
v
- the visitor
- Throws:
StandardException
- on error
getPrivType
int getPrivType()
- Set default privilege of EXECUTE for this node.
- Overrides:
getPrivType
in class DMLStatementNode
- Returns:
- true if the statement is atomic
checkReliability
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.
- Throws:
StandardException
getSQLAllowedInProcedure
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:
- SQL allowed by the procedure
Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.