|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.JavaValueNode
org.apache.derby.impl.sql.compile.MethodCallNode
org.apache.derby.impl.sql.compile.StaticMethodCallNode
A StaticMethodCallNode represents a static method call from a Class (as opposed to from an Object). For a procedure the call requires that the arguments be ? parameters. The parameter is *logically* passed into the method call a number of different ways.
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(?) }
Field Summary | |
(package private) AliasDescriptor |
ad
|
private boolean |
alreadyBound
|
private int[] |
applicationParameterNumbers
|
private boolean |
isSystemCode
|
private LocalField[] |
outParamArrays
|
private TableName |
procedureName
|
private LocalField |
returnsNullOnNullState
|
Fields inherited from class org.apache.derby.impl.sql.compile.MethodCallNode |
actualMethodReturnType, internalCall, javaClassName, method, methodName, methodParameterTypes, methodParms, routineInfo, signature |
Fields inherited from class org.apache.derby.impl.sql.compile.JavaValueNode |
forCallStatement, jsqlType |
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 | |
StaticMethodCallNode()
|
Method Summary | |
JavaValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
Bind this expression. |
boolean |
categorize(JBitSet referencedTabs,
boolean simplePredsOnly)
Categorize this predicate. |
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. |
void |
init(java.lang.Object methodName,
java.lang.Object javaClassName)
Intializer for a NonStaticMethodCallNode |
java.lang.String |
toString()
Convert this object to a String. |
Methods inherited from class org.apache.derby.impl.sql.compile.MethodCallNode |
accept, addParms, addParms, areParametersQueryInvariant, bindParameters, generateParameters, getIsParam, getJavaClassName, getMethodName, getMethodParms, getObjectSignature, getOrderableVariantType, getParameterTypeName, getPrimitiveSignature, getSignature, init, preprocess, printSubNodes, remapColumnReferencesToExpressions, resolveMethodCall, setClause, setNullParameterInfo, someParametersAreNull, throwNoMethodFound |
Methods inherited from class org.apache.derby.impl.sql.compile.JavaValueNode |
castToPrimitive, checkReliability, generate, generateReceiver, generateReceiver, getConstantValueAsObject, getJavaTypeName, getJSQLType, getPrimitiveTypeName, getReceiverExpression, isPrimitiveType, mapToTypeID, markForCallStatement, markReturnValueDiscarded, mustCastToPrimitive, returnValueDiscarded, returnValueToSQLDomain, setJavaTypeName, valueReturnedToSQLDomain |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private TableName procedureName
private LocalField[] outParamArrays
private int[] applicationParameterNumbers
private boolean isSystemCode
private boolean alreadyBound
private LocalField returnsNullOnNullState
AliasDescriptor ad
Constructor Detail |
public StaticMethodCallNode()
Method Detail |
public void init(java.lang.Object methodName, java.lang.Object javaClassName)
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 JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector 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 AggregateNodes
StandardException
- Thrown on errorValueNode.bindExpression(org.apache.derby.impl.sql.compile.FromList, org.apache.derby.impl.sql.compile.SubqueryList, java.util.Vector)
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 map
StandardException
- Thrown on errorpublic 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 into
StandardException
- Thrown on error
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |