Class NonStaticMethodCallNode
- java.lang.Object
-
- org.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.NonStaticMethodCallNode
-
- All Implemented Interfaces:
Visitable
class NonStaticMethodCallNode extends MethodCallNode
A NonStaticMethodCallNode is really a node to represent a (static or non-static) method call from an object (as opposed to a static method call from a class.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
isStatic
(package private) JavaValueNode
receiver
-
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_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description NonStaticMethodCallNode(java.lang.String methodName, ValueNode receiver, ContextManager cm)
Constructor for a NonStaticMethodCallNode
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node.(package private) JavaValueNode
bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates)
Bind this expression.(package private) boolean
categorize(JBitSet referencedTabs, boolean simplePredsOnly)
Categorize this predicate.(package private) void
generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
Do code generation for this method call(package private) boolean
generateReceiver(ExpressionClassBuilder acb, MethodBuilder mb)
Generate the expression that evaluates to the receiver.(package private) int
getOrderableVariantType()
Return the variant type for the underlying expression.(package private) void
preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList)
Preprocess an expression tree.(package private) void
printSubNodes(int depth)
Prints the sub-nodes of this object.(package private) JavaValueNode
remapColumnReferencesToExpressions()
Remap all ColumnReferences in this tree to be clones of the underlying expression.-
Methods inherited from class org.apache.derby.impl.sql.compile.MethodCallNode
addParms, areParametersQueryInvariant, bindParameters, generateOneParameter, generateParameters, getCorrelationTables, getDataType, getFirstVarargIdx, getFullName, getIsParam, getJavaClassName, getMethodName, getMethodParameterClasses, getMethodParms, getObjectSignature, getObjectTypeName, getParameterTypeName, getPrimitiveSignature, getResolvedMethod, getRoutineArgIdx, getRoutineArgIdx, getRoutineInfo, hasVarargs, isVararg, resolveMethodCall, setNullParameterInfo, someParametersAreNull, stripOneArrayLevel, throwNoMethodFound, toString
-
Methods inherited from class org.apache.derby.impl.sql.compile.JavaValueNode
castToPrimitive, checkReliability, generate, generateReceiver, getCollationType, getConstantValueAsObject, getJavaTypeName, getJSQLType, getPrimitiveTypeName, getReceiverExpression, isPrimitiveType, mapToTypeID, markForCallStatement, markReturnValueDiscarded, mustCastToPrimitive, returnValueDiscarded, returnValueToSQLDomain, setCollationType, setJavaTypeName, valueReturnedToSQLDomain
-
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, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Field Detail
-
receiver
JavaValueNode receiver
-
isStatic
private boolean isStatic
-
-
Constructor Detail
-
NonStaticMethodCallNode
NonStaticMethodCallNode(java.lang.String methodName, ValueNode receiver, ContextManager cm) throws StandardException
Constructor for a NonStaticMethodCallNode- Parameters:
methodName
- The name of the method to callreceiver
- A JavaValueNode representing the receiving objectcm
- The context manager- Throws:
StandardException
- Thrown on error
-
-
Method Detail
-
bindExpression
JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates) throws StandardException
Bind this expression. This means binding the sub-expressions, as well as figuring out what the return type is for this expression.- Specified by:
bindExpression
in classJavaValueNode
- Parameters:
fromList
- The FROM list for the query this expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregates
- The aggregate list being built as we find AggregateNodes- Returns:
- this
- Throws:
StandardException
- Thrown on error- See Also:
ValueNode.bindExpression(org.apache.derby.impl.sql.compile.FromList, org.apache.derby.impl.sql.compile.SubqueryList, java.util.List<org.apache.derby.impl.sql.compile.AggregateNode>)
-
categorize
boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) throws 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.- Overrides:
categorize
in classMethodCallNode
- Parameters:
referencedTabs
- JBitSet with bit map of referenced FromTablessimplePredsOnly
- Whether or not to consider method calls, field references and conditional nodes when building bit map- Returns:
- boolean Whether or not source.expression is a ColumnReference or a VirtualColumnNode.
- Throws:
StandardException
- Thrown on error- See Also:
ValueNode.categorize(org.apache.derby.iapi.util.JBitSet, boolean)
-
getOrderableVariantType
int getOrderableVariantType() throws 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:
getOrderableVariantType
in classMethodCallNode
- Returns:
- The variant type for the underlying expression.
- Throws:
StandardException
-
remapColumnReferencesToExpressions
JavaValueNode remapColumnReferencesToExpressions() throws StandardException
Remap all ColumnReferences in this tree to be clones of the underlying expression.- Overrides:
remapColumnReferencesToExpressions
in classMethodCallNode
- Returns:
- JavaValueNode The remapped expression tree.
- Throws:
StandardException
- Thrown on error- See Also:
ValueNode.remapColumnReferencesToExpressions()
-
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 classMethodCallNode
- Parameters:
depth
- The depth of this node in the tree
-
preprocess
void preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws 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.- Overrides:
preprocess
in classMethodCallNode
- Parameters:
numTables
- Number of tables in the DML StatementouterFromList
- FromList from outer query blockouterSubqueryList
- SubqueryList from outer query blockouterPredicateList
- PredicateList from outer query block- Throws:
StandardException
- Thrown on error- See Also:
ValueNode.preprocess(int, org.apache.derby.impl.sql.compile.FromList, org.apache.derby.impl.sql.compile.SubqueryList, org.apache.derby.impl.sql.compile.PredicateList)
-
generateExpression
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
Do code generation for this method call- Specified by:
generateExpression
in classJavaValueNode
- Parameters:
acb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the expression will go into- Throws:
StandardException
- Thrown on error
-
generateReceiver
boolean generateReceiver(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
Generate the expression that evaluates to the receiver. This is for the case where a java expression is being returned to the SQL domain, and we need to check whether the receiver is null (if so, the SQL value should be set to null, and this Java expression not evaluated). Instance method calls and field references have receivers, while class method calls and calls to constructors do not. If this Java expression does not have a receiver, this method returns null. Only generate the receiver once and cache it in a field. This is because there will be two references to the receiver, and we want to evaluate it only once.- Overrides:
generateReceiver
in classJavaValueNode
- Parameters:
acb
- The ExpressionClassBuilder for the class being builtmb
- The method the expression will go into- Returns:
- true if compiled receiver, false otherwise.
- Throws:
StandardException
- Thrown on error
-
acceptChildren
void acceptChildren(Visitor v) throws StandardException
Accept the visitor for all visitable children of this node.- Overrides:
acceptChildren
in classMethodCallNode
- Parameters:
v
- the visitor- Throws:
StandardException
- on error
-
-