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
class CallStatementNode extends DMLStatementNode
An CallStatementNode represents a CALLstatement. 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
Fields Modifier and Type Field Description private JavaToSQLValueNode
methodCall
The method call for the Java procedure.-
Fields inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode
resultSet
-
Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode
EMPTY_TD_LIST, 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_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description CallStatementNode(JavaToSQLValueNode methodCall, ContextManager cm)
Constructor for a CallStatementNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node.void
bindStatement()
Bind this UpdateNode.private void
checkReliability()
This method checks if the called procedure allows modification of SQL data.(package private) void
generate(ActivationClassBuilder acb, MethodBuilder mb)
Code generation for CallStatementNode.(package private) int
getPrivType()
Set default privilege of EXECUTE for this node.private short
getSQLAllowedInProcedure()
This method checks the SQL allowed by the called procedure.ResultDescription
makeResultDescription()
Make a ResultDescription for use in a PreparedStatement.void
optimizeStatement()
Optimize a DML statement (which is the only type of statement that should need optimizing, I think).(package private) void
printSubNodes(int depth)
Prints the sub-nodes of this object.(package private) java.lang.String
statementToString()
-
Methods inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode
activationKind, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getResultSetNode, isAtomic
-
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
executeSchemaName, executeStatementName, generate, getCursorInfo, getSPSName, lockTableForCompilation, needsSavepoint, toString, updateIndexStatisticsFor
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Field Detail
-
methodCall
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
-
CallStatementNode
CallStatementNode(JavaToSQLValueNode methodCall, ContextManager cm)
Constructor for a CallStatementNode.- Parameters:
methodCall
- The expression to "call"cm
- The context manager
-
-
Method Detail
-
statementToString
java.lang.String statementToString()
- Specified by:
statementToString
in classStatementNode
-
printSubNodes
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 classDMLStatementNode
- 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 classStatementNode
- 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 classDMLStatementNode
- Throws:
StandardException
- Thrown on error
-
generate
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 classQueryTreeNode
- 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 classDMLStatementNode
- 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 classDMLStatementNode
- Parameters:
v
- the visitor- Throws:
StandardException
- on error
-
getPrivType
int getPrivType()
Set default privilege of EXECUTE for this node.- Overrides:
getPrivType
in classDMLStatementNode
- 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 isCompilerContext.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
-
-