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
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
FieldsModifier and TypeFieldDescriptionprivate JavaToSQLValueNode
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
ConstructorsConstructorDescriptionCallStatementNode
(JavaToSQLValueNode methodCall, ContextManager cm) Constructor for a CallStatementNode. -
Method Summary
Modifier and TypeMethodDescription(package private) void
Accept the visitor for all visitable children of this node.void
Bind this UpdateNode.private void
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
Set default privilege of EXECUTE for this node.private short
This method checks the SQL allowed by the called procedure.Make a ResultDescription for use in a PreparedStatement.void
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) String
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 Details
-
methodCall
The method call for the Java procedure. Guaranteed to be a JavaToSQLValueNode wrapping a MethodCallNode by checks in the parser.
-
-
Constructor Details
-
CallStatementNode
CallStatementNode(JavaToSQLValueNode methodCall, ContextManager cm) Constructor for a CallStatementNode.- Parameters:
methodCall
- The expression to "call"cm
- The context manager
-
-
Method Details
-
statementToString
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
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
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
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
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
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
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
-