|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.compile
Class MethodCallNode

java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.JavaValueNode
org.apache.derby.impl.sql.compile.MethodCallNode
- All Implemented Interfaces:
- org.apache.derby.iapi.sql.compile.Visitable
- Direct Known Subclasses:
- NewInvocationNode, NonStaticMethodCallNode, StaticMethodCallNode
- public abstract class MethodCallNode
- extends JavaValueNode
A MethodCallNode represents a Java method call. Method calls can be done through DML (as expressions) or through the CALL statement.
| Field Summary | |
protected java.lang.String |
actualMethodReturnType
|
(package private) boolean |
internalCall
True if this is an internal call, just used to set up a generated method call. |
protected java.lang.String |
javaClassName
The name of the class containing the method. |
protected java.lang.reflect.Member |
method
|
protected java.lang.String |
methodName
|
(package private) java.lang.String[] |
methodParameterTypes
The parameter types for the resolved method. |
protected JavaValueNode[] |
methodParms
|
private java.lang.String[] |
procedurePrimitiveArrayType
For resolution of procedure INOUT/OUT parameters to the primitive form, such as int[]. |
(package private) org.apache.derby.catalog.types.RoutineAliasInfo |
routineInfo
For a procedure or function call |
protected org.apache.derby.iapi.types.JSQLType[] |
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 | |
MethodCallNode()
|
|
| Method Summary | |
org.apache.derby.iapi.sql.compile.Visitable |
accept(org.apache.derby.iapi.sql.compile.Visitor v)
Accept a visitor, and call v.visit() on child nodes as necessary. |
void |
addParms(JavaValueNode[] methodParms)
Add the parameter list. |
void |
addParms(java.util.Vector parameterList)
Add the parameter list |
protected boolean |
areParametersQueryInvariant()
Return whether or not all of the parameters to this node are QUERY_INVARIANT or CONSTANT. |
(package private) void |
bindParameters(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
Bind this expression. |
boolean |
categorize(org.apache.derby.iapi.util.JBitSet referencedTabs,
boolean simplePredsOnly)
Categorize this predicate. |
void |
generateOneParameter(ExpressionClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb,
int parameterNumber)
Generate one parameter to the given method call. |
int |
generateParameters(ExpressionClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb)
Generate the parameters to the given method call |
protected boolean[] |
getIsParam()
Build an array of booleans denoting whether or not a given method parameter is a ?. |
java.lang.String |
getJavaClassName()
|
java.lang.String |
getMethodName()
|
JavaValueNode[] |
getMethodParms()
Get the method parameters. |
protected java.lang.String[] |
getObjectSignature()
Build an array of names of the argument types. |
private java.lang.String |
getObjectTypeName(org.apache.derby.iapi.types.JSQLType jsqlType)
|
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
static java.lang.String |
getParameterTypeName(JavaValueNode param)
|
(package private) java.lang.String[] |
getPrimitiveSignature(boolean castToPrimitiveAsNecessary)
|
org.apache.derby.iapi.types.JSQLType[] |
getSignature()
Gets the signature of JSQLTypes needed to propagate a work unit from target to source. |
private int |
getVariantTypeOfParams()
|
void |
init(java.lang.Object methodName)
Initializer for a MethodCallNode |
private java.lang.String[] |
parseValidateSignature(java.lang.String externalName,
int offset,
boolean hasDynamicResultSets)
Parse the user supplied signature for a method and validate it, need to match the number of parameters passed in and match the valid types for the parameter. |
void |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
Preprocess an expression tree. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
JavaValueNode |
remapColumnReferencesToExpressions()
Remap all ColumnReferences in this tree to be clones of the underlying expression. |
protected void |
resolveMethodCall(java.lang.String javaClassName,
boolean staticMethod)
|
void |
setClause(int clause)
Set the clause that this node appears in. |
void |
setNullParameterInfo(java.lang.String[] parmTypeNames)
Set the appropriate type information for a null passed as a parameter. |
protected boolean |
someParametersAreNull()
Return true if some parameters are null, false otherwise. |
(package private) void |
throwNoMethodFound(java.lang.String receiverTypeName,
java.lang.String[] parmTypeNames,
java.lang.String[] primParmTypeNames)
Build parameters for error message and throw the exception when there is no matching signature found. |
java.lang.String |
toString()
Convert this object to a String. |
| Methods inherited from class org.apache.derby.impl.sql.compile.JavaValueNode |
bindExpression, castToPrimitive, checkReliability, generate, generateExpression, 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 |
methodName
protected java.lang.String methodName
javaClassName
protected java.lang.String javaClassName
- The name of the class containing the method. May not be known until bindExpression() has been called.
routineInfo
org.apache.derby.catalog.types.RoutineAliasInfo routineInfo
- For a procedure or function call
internalCall
boolean internalCall
- True if this is an internal call, just used to set up a generated method call.
procedurePrimitiveArrayType
private java.lang.String[] procedurePrimitiveArrayType
- For resolution of procedure INOUT/OUT parameters to the primitive
form, such as int[]. May be null.
signature
protected org.apache.derby.iapi.types.JSQLType[] signature
methodParms
protected JavaValueNode[] methodParms
method
protected java.lang.reflect.Member method
actualMethodReturnType
protected java.lang.String actualMethodReturnType
methodParameterTypes
java.lang.String[] methodParameterTypes
- The parameter types for the resolved method.
| Constructor Detail |
MethodCallNode
public MethodCallNode()
| Method Detail |
getSignature
public org.apache.derby.iapi.types.JSQLType[] getSignature()
- Gets the signature of JSQLTypes needed to propagate a work unit from
target to source.
init
public void init(java.lang.Object methodName)
- Initializer for a MethodCallNode
- Overrides:
initin classQueryTreeNode
getMethodName
public java.lang.String getMethodName()
getJavaClassName
public java.lang.String getJavaClassName()
setClause
public void setClause(int clause)
- Set the clause that this node appears in.
- Overrides:
setClausein classJavaValueNode
addParms
public void addParms(JavaValueNode[] methodParms)
- Add the parameter list.
(This flavor is useful when transforming a non-static method call node
to a static method call node.)
addParms
public void addParms(java.util.Vector parameterList) throws org.apache.derby.iapi.error.StandardException
- Add the parameter list
printSubNodes
public void printSubNodes(int depth)
- Prints the sub-nodes of this object. See QueryTreeNode.java for
how tree printing is supposed to work.
- Overrides:
printSubNodesin classQueryTreeNode
toString
public java.lang.String toString()
- Convert this object to a String. See comments in QueryTreeNode.java
for how this should be done for tree printing.
- Overrides:
toStringin classQueryTreeNode
bindParameters
final void bindParameters(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector) throws org.apache.derby.iapi.error.StandardException
- Bind this expression. This means binding the sub-expressions,
as well as figuring out what the return type is for this expression.
areParametersQueryInvariant
protected boolean areParametersQueryInvariant()
throws org.apache.derby.iapi.error.StandardException
- Return whether or not all of the parameters to this node are
QUERY_INVARIANT or CONSTANT. This is useful for VTIs - a VTI is a candidate
for materialization if all of its parameters are QUERY_INVARIANT or CONSTANT
throwNoMethodFound
void throwNoMethodFound(java.lang.String receiverTypeName, java.lang.String[] parmTypeNames, java.lang.String[] primParmTypeNames) throws org.apache.derby.iapi.error.StandardException
- Build parameters for error message and throw the exception when there
is no matching signature found.
preprocess
public void preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
throws org.apache.derby.iapi.error.StandardException
- Preprocess an expression tree. We do a number of transformations
here (including subqueries, IN lists, LIKE and BETWEEN) plus
subquery flattening.
NOTE: This is done before the outer ResultSetNode is preprocessed.
- Specified by:
preprocessin classJavaValueNode
categorize
public boolean categorize(org.apache.derby.iapi.util.JBitSet referencedTabs, boolean simplePredsOnly) throws org.apache.derby.iapi.error.StandardException
- Categorize this predicate. Initially, this means
building a bit map of the referenced tables for each predicate.
If the source of this ColumnReference (at the next underlying level)
is not a ColumnReference or a VirtualColumnNode then this predicate
will not be pushed down.
For example, in:
select * from (select 1 from s) a (x) where x = 1
we will not push down x = 1.
NOTE: It would be easy to handle the case of a constant, but if the
inner SELECT returns an arbitrary expression, then we would have to copy
that tree into the pushed predicate, and that tree could contain
subqueries and method calls.
RESOLVE - revisit this issue once we have views.
- Specified by:
categorizein classJavaValueNode
remapColumnReferencesToExpressions
public JavaValueNode remapColumnReferencesToExpressions() throws org.apache.derby.iapi.error.StandardException
- Remap all ColumnReferences in this tree to be clones of the
underlying expression.
- Specified by:
remapColumnReferencesToExpressionsin classJavaValueNode
generateParameters
public int generateParameters(ExpressionClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb) throws org.apache.derby.iapi.error.StandardException
- Generate the parameters to the given method call
getParameterTypeName
public static java.lang.String getParameterTypeName(JavaValueNode param) throws org.apache.derby.iapi.error.StandardException
generateOneParameter
public void generateOneParameter(ExpressionClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb, int parameterNumber) throws org.apache.derby.iapi.error.StandardException
- Generate one parameter to the given method call. This method is overriden by
RepStaticMethodCallNode.
setNullParameterInfo
public void setNullParameterInfo(java.lang.String[] parmTypeNames) throws org.apache.derby.iapi.error.StandardException
- Set the appropriate type information for a null passed as a parameter.
This method is called after method resolution, when a signature was
successfully matched.
resolveMethodCall
protected void resolveMethodCall(java.lang.String javaClassName, boolean staticMethod) throws org.apache.derby.iapi.error.StandardException
parseValidateSignature
private java.lang.String[] parseValidateSignature(java.lang.String externalName, int offset, boolean hasDynamicResultSets) throws org.apache.derby.iapi.error.StandardException
- Parse the user supplied signature for a method and validate
it, need to match the number of parameters passed in and match
the valid types for the parameter.
someParametersAreNull
protected boolean someParametersAreNull()
- Return true if some parameters are null, false otherwise.
getObjectSignature
protected java.lang.String[] getObjectSignature() throws org.apache.derby.iapi.error.StandardException
- Build an array of names of the argument types. These types are biased toward
Java objects. That is, if an argument is of SQLType, then we map it to the
corresponding Java synonym class (e.g., SQLINT is mapped to 'java.lang.Integer').
getIsParam
protected boolean[] getIsParam()
- Build an array of booleans denoting whether or not a given method
parameter is a ?.
getObjectTypeName
private java.lang.String getObjectTypeName(org.apache.derby.iapi.types.JSQLType jsqlType) throws org.apache.derby.iapi.error.StandardException
getPrimitiveSignature
java.lang.String[] getPrimitiveSignature(boolean castToPrimitiveAsNecessary) throws org.apache.derby.iapi.error.StandardException
getOrderableVariantType
protected int getOrderableVariantType()
throws org.apache.derby.iapi.error.StandardException
- Return the variant type for the underlying expression.
The variant type can be:
VARIANT - variant within a scan
(non-static field access)
SCAN_INVARIANT - invariant within a scan
(column references from outer tables)
QUERY_INVARIANT - invariant within the life of a query
(constant expressions)
- Overrides:
getOrderableVariantTypein classJavaValueNode
getVariantTypeOfParams
private int getVariantTypeOfParams()
throws org.apache.derby.iapi.error.StandardException
getMethodParms
public JavaValueNode[] getMethodParms()
- Get the method parameters.
accept
public org.apache.derby.iapi.sql.compile.Visitable accept(org.apache.derby.iapi.sql.compile.Visitor v) throws org.apache.derby.iapi.error.StandardException
- Accept a visitor, and call v.visit()
on child nodes as necessary.
- Specified by:
acceptin interfaceorg.apache.derby.iapi.sql.compile.Visitable- Overrides:
acceptin classQueryTreeNode
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC