public class StaticMethodCallNode extends MethodCallNode
For a application call like CALL MYPROC(?) the logically Java method call is
(in psuedo Java/SQL code) (examples with CHAR(10) parameter)
Fixed length IN parameters - com.acme.MyProcedureMethod(?)
Variable length IN parameters - com.acme.MyProcedureMethod(CAST (? AS CHAR(10))
Fixed length INOUT parameter -
String[] holder = new String[] {?}; com.acme.MyProcedureMethod(holder); ? = holder[0]
Variable length INOUT parameter -
String[] holder = new String[] {CAST (? AS CHAR(10)}; com.acme.MyProcedureMethod(holder); ? = CAST (holder[0] AS CHAR(10))
Fixed length OUT parameter -
String[] holder = new String[1]; com.acme.MyProcedureMethod(holder); ? = holder[0]
Variable length INOUT parameter -
String[] holder = new String[1]; com.acme.MyProcedureMethod(holder); ? = CAST (holder[0] AS CHAR(10))
For static method calls there is no pre-definition of an IN or INOUT parameter, so a call to CallableStatement.registerOutParameter() makes the parameter an INOUT parameter, provided: - the parameter is passed directly to the method call (no casts or expressions). - the method's parameter type is a Java array type. Since this is a dynmaic decision we compile in code to take both paths, based upon a boolean isINOUT which is dervied from the ParameterValueSet. Code is logically (only single parameter String[] shown here). Note, no casts can exist here. boolean isINOUT = getParameterValueSet().getParameterMode(0) == PARAMETER_IN_OUT; if (isINOUT) { String[] holder = new String[] {?}; com.acme.MyProcedureMethod(holder); ? = holder[0] } else { com.acme.MyProcedureMethod(?) }
Modifier and Type | Field and Description |
---|---|
(package private) AliasDescriptor |
ad |
private boolean |
appearsInGroupBy |
private int[] |
applicationParameterNumbers |
private boolean |
isInsideBind
This flag is true while bindExpression() is executing.
|
private boolean |
isSystemCode |
private LocalField[] |
outParamArrays |
private TableName |
procedureName |
private AggregateNode |
resolvedAggregate |
private LocalField |
returnsNullOnNullState
Generated boolean field to hold the indicator
for if any of the parameters to a
RETURNS NULL ON NULL INPUT function are NULL.
|
private java.lang.String |
routineDefiner
Authorization id of user owning schema in which routine is defined.
|
actualMethodReturnType, internalCall, javaClassName, method, methodName, methodParameterTypes, methodParms, routineInfo, signature
forCallStatement, jsqlType
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor and Description |
---|
StaticMethodCallNode() |
Modifier and Type | Method and Description |
---|---|
JavaValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
Bind this expression.
|
private JavaValueNode |
bindExpressionMinion(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector) |
boolean |
categorize(JBitSet referencedTabs,
boolean simplePredsOnly)
Categorize this predicate.
|
private void |
coerceMethodParameter(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector,
RoutineAliasInfo rai,
int parameterCount,
DataTypeDescriptor paramdtd,
TypeId parameterTypeId,
int parameterMode,
int p)
Coerce an actual method parameter to the declared type of the corresponding
routine argument.
|
void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
Do code generation for this method call
|
void |
generateOneParameter(ExpressionClassBuilder acb,
MethodBuilder mb,
int parameterNumber)
Push extra code to generate the casts within the
arrays for the parameters passed as arrays.
|
private void |
generateSetupNestedSessionContext(ActivationClassBuilder acb,
MethodBuilder mb,
boolean hadDefinersRights,
java.lang.String definer)
Add code to set up the SQL session context for a stored
procedure or function which needs a nested SQL session
context (only needed for those which can contain SQL).
|
(package private) int |
getPrivType()
Set default privilege of EXECUTE for this node.
|
AggregateNode |
getResolvedAggregate()
Get the aggregate, if any, which this method call resolves to.
|
void |
init(java.lang.Object methodName,
java.lang.Object javaClassName)
Intializer for a NonStaticMethodCallNode
|
static ValueNode |
makeCast(ValueNode parameterNode,
DataTypeDescriptor targetType,
NodeFactory nodeFactory,
ContextManager cm)
Wrap a parameter in a CAST node.
|
private void |
optimizeDomainValueConversion()
If this SQL function has parameters which are SQLToJavaValueNode over
JavaToSQLValueNode and the java value node underneath is a SQL function
defined with CALLED ON NULL INPUT, then we can get rid of the wrapper
nodes over the java value node for such parameters.
|
private boolean |
permitsSQL(RoutineAliasInfo rai)
Returns true if the routine permits SQL.
|
private void |
resolveRoutine(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector,
SchemaDescriptor sd)
Resolve a routine.
|
void |
setAppearsInGroupBy()
Flag that this function invocation appears in a GROUP BY clause
|
java.lang.String |
toString()
Convert this object to a String.
|
acceptChildren, addParms, areParametersQueryInvariant, bindParameters, generateParameters, getCorrelationTables, getDataType, getFirstVarargIdx, getIsParam, getJavaClassName, getMethodName, getMethodParameterClasses, getMethodParms, getObjectSignature, getObjectTypeName, getOrderableVariantType, getParameterTypeName, getPrimitiveSignature, getResolvedMethod, getRoutineArgIdx, getRoutineArgIdx, getRoutineInfo, hasVarargs, init, isVararg, preprocess, printSubNodes, remapColumnReferencesToExpressions, resolveMethodCall, setNullParameterInfo, someParametersAreNull, stripOneArrayLevel, throwNoMethodFound
castToPrimitive, checkReliability, generate, generateReceiver, generateReceiver, getCollationType, getConstantValueAsObject, getJavaTypeName, getJSQLType, getPrimitiveTypeName, getReceiverExpression, isPrimitiveType, mapToTypeID, markForCallStatement, markReturnValueDiscarded, mustCastToPrimitive, returnValueDiscarded, returnValueToSQLDomain, setCollationType, setJavaTypeName, valueReturnedToSQLDomain
accept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, 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, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExist
private TableName procedureName
private LocalField[] outParamArrays
private int[] applicationParameterNumbers
private boolean isSystemCode
private boolean isInsideBind
private LocalField returnsNullOnNullState
private java.lang.String routineDefiner
AliasDescriptor ad
private AggregateNode resolvedAggregate
private boolean appearsInGroupBy
public void init(java.lang.Object methodName, java.lang.Object javaClassName)
init
in interface Node
init
in class QueryTreeNode
methodName
- The name of the method to calljavaClassName
- The name of the java class that the static method belongs to.public AggregateNode getResolvedAggregate()
public void setAppearsInGroupBy()
public JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List aggregateVector) throws StandardException
bindExpression
in class JavaValueNode
fromList
- The FROM list for the query this
expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregateVector
- The aggregate vector being built as we find AggregateNodesStandardException
- Thrown on errorValueNode.bindExpression(org.apache.derby.impl.sql.compile.FromList, org.apache.derby.impl.sql.compile.SubqueryList, java.util.List)
private JavaValueNode bindExpressionMinion(FromList fromList, SubqueryList subqueryList, java.util.List aggregateVector) throws StandardException
StandardException
private boolean permitsSQL(RoutineAliasInfo rai)
private void optimizeDomainValueConversion() throws StandardException
StandardException
private void resolveRoutine(FromList fromList, SubqueryList subqueryList, java.util.List aggregateVector, SchemaDescriptor sd) throws StandardException
fromList
- subqueryList
- aggregateVector
- sd
- StandardException
private void coerceMethodParameter(FromList fromList, SubqueryList subqueryList, java.util.List aggregateVector, RoutineAliasInfo rai, int parameterCount, DataTypeDescriptor paramdtd, TypeId parameterTypeId, int parameterMode, int p) throws StandardException
Coerce an actual method parameter to the declared type of the corresponding routine argument.
StandardException
public static ValueNode makeCast(ValueNode parameterNode, DataTypeDescriptor targetType, NodeFactory nodeFactory, ContextManager cm) throws StandardException
StandardException
private void generateSetupNestedSessionContext(ActivationClassBuilder acb, MethodBuilder mb, boolean hadDefinersRights, java.lang.String definer) throws StandardException
acb
- activation class buildermb
- method builderStandardException
LanguageConnectionContext.setupNestedSessionContext(org.apache.derby.iapi.sql.Activation, boolean, java.lang.String)
public void generateOneParameter(ExpressionClassBuilder acb, MethodBuilder mb, int parameterNumber) throws StandardException
generateOneParameter
in class MethodCallNode
acb
- The ExpressionClassBuilder for the class we're generatingmb
- the method the expression will go intoparameterNumber
- Identifies which parameter to generate. 0 based.StandardException
- Thrown on errorpublic boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) throws StandardException
categorize
in class MethodCallNode
referencedTabs
- JBitSet with bit map of referenced FromTablessimplePredsOnly
- Whether or not to consider method
calls, field references and conditional nodes
when building bit mapStandardException
- Thrown on errorValueNode.categorize(org.apache.derby.iapi.util.JBitSet, boolean)
public java.lang.String toString()
toString
in class MethodCallNode
public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateExpression
in class JavaValueNode
acb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the expression will go intoStandardException
- Thrown on errorint getPrivType()
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.