com.akiban.sql.parser
Class StaticMethodCallNode
java.lang.Object
com.akiban.sql.parser.QueryTreeNode
com.akiban.sql.parser.JavaValueNode
com.akiban.sql.parser.MethodCallNode
com.akiban.sql.parser.StaticMethodCallNode
- All Implemented Interfaces:
- Visitable
public class StaticMethodCallNode
- extends MethodCallNode
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(?)
}
| Methods inherited from class com.akiban.sql.parser.JavaValueNode |
castToPrimitive, getJavaTypeName, getJSQLType, getPrimitiveTypeName, getType, isPrimitiveType, mapToTypeID, markForCallStatement, markReturnValueDiscarded, mustCastToPrimitive, returnValueDiscarded, returnValueToSQLDomain, setJavaTypeName, valueReturnedToSQLDomain |
| Methods inherited from class com.akiban.sql.parser.QueryTreeNode |
accept, convertDefaultNode, debugFlush, debugPrint, formatNodeString, getBeginOffset, getDebugOutput, getEndOffset, getNodeFactory, getNodeType, getNullNode, getParserContext, getStatementType, getUserData, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, makeTableName, makeTableName, nodeHeader, printLabel, setBeginOffset, setDebugOutput, setEndOffset, setNodeType, setParserContext, setUserData, stackPrint, treePrint, treePrint, treePrint |
StaticMethodCallNode
public StaticMethodCallNode()
init
public void init(Object methodName,
Object javaClassName)
- Intializer for a NonStaticMethodCallNode
- Overrides:
init in class QueryTreeNode
- Parameters:
methodName - The name of the method to calljavaClassName - The name of the java class that the static method belongs to.
getProcedureName
public TableName getProcedureName()
copyFrom
public void copyFrom(QueryTreeNode node)
throws StandardException
- Fill this node with a deep copy of the given node.
- Overrides:
copyFrom in class MethodCallNode
- Throws:
StandardException
toString
public String toString()
- Convert this object to a String. See comments in QueryTreeNode.java
for how this should be done for tree printing.
- Overrides:
toString in class MethodCallNode
- Returns:
- This object as a String
Copyright © 2013 Akiban Technologies, Inc. All rights reserved.