Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class NonStaticMethodCallNode

extends MethodCallNode
Class Inheritance
Imports
java.lang.reflect.Modifier, java.util.List, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.classfile.VMOpcode, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.loader.ClassInspector, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.compile.Visitor, org.apache.derby.iapi.store.access.Qualifier, org.apache.derby.iapi.util.JBitSet

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

Modifier and TypeField and Description
private boolean
pack-priv JavaValueNode
Inherited from org.apache.derby.impl.sql.compile.MethodCallNode:
actualMethodReturnTypeinternalCalljavaClassNamemethodmethodNamemethodParameterTypesmethodParmsroutineInfosignature

Constructor Summary

AccessConstructor and Description
pack-priv
NonStaticMethodCallNode(String
The name of the method to call
methodName
,
ValueNode
A JavaValueNode representing the receiving object
receiver
,
ContextManager
The context manager
cm
)

Constructor for a NonStaticMethodCallNode

Method Summary

Modifier and TypeMethod and Description
pack-priv void
acceptChildren(Visitor
the visitor
v
)

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.acceptChildren.

Accept the visitor for all visitable children of this node.

pack-priv JavaValueNode

Returns:

this
bindExpression
(FromList
The FROM list for the query this expression is in, for binding columns.
fromList
,
SubqueryList
The subquery list being built as we find SubqueryNodes
subqueryList
,
List<AggregateNode>
The aggregate list being built as we find AggregateNodes
aggregates
)

Implements abstract org.apache.derby.impl.sql.compile.JavaValueNode.bindExpression.

Bind this expression.

pack-priv boolean

Returns:

boolean Whether or not source.expression is a ColumnReference or a VirtualColumnNode.
categorize
(JBitSet
JBitSet with bit map of referenced FromTables
referencedTabs
,
boolean
Whether or not to consider method calls, field references and conditional nodes when building bit map
simplePredsOnly
)

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.categorize.

Categorize this predicate.

pack-priv void
generateExpression(ExpressionClassBuilder
The ExpressionClassBuilder for the class we're generating
acb
,
MethodBuilder
The method the expression will go into
mb
)

Implements abstract org.apache.derby.impl.sql.compile.JavaValueNode.generateExpression.

Do code generation for this method call

pack-priv boolean

Returns:

true if compiled receiver, false otherwise.
generateReceiver
(ExpressionClassBuilder
The ExpressionClassBuilder for the class being built
acb
,
MethodBuilder
The method the expression will go into
mb
)

Overrides org.apache.derby.impl.sql.compile.JavaValueNode.generateReceiver.

Generate the expression that evaluates to the receiver.

pack-priv int

Returns:

The variant type for the underlying expression.
getOrderableVariantType
()

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.getOrderableVariantType.

Return the variant type for the underlying expression.

pack-priv void
preprocess(int
Number of tables in the DML Statement
numTables
,
FromList
FromList from outer query block
outerFromList
,
SubqueryList
SubqueryList from outer query block
outerSubqueryList
,
PredicateList
PredicateList from outer query block
outerPredicateList
)

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.preprocess.

Preprocess an expression tree.

pack-priv void
printSubNodes(int
The depth of this node in the tree
depth
)

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.printSubNodes.

Prints the sub-nodes of this object.

pack-priv JavaValueNode

Returns:

JavaValueNode The remapped expression tree.
remapColumnReferencesToExpressions
()

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.remapColumnReferencesToExpressions.

Remap all ColumnReferences in this tree to be clones of the underlying expression.

Inherited from org.apache.derby.impl.sql.compile.MethodCallNode:
addParmsareParametersQueryInvariantbindParametersgenerateOneParametergenerateParametersgetCorrelationTablesgetDataTypegetFirstVarargIdxgetFullNamegetIsParamgetJavaClassNamegetMethodNamegetMethodParameterClassesgetMethodParmsgetObjectSignaturegetObjectTypeNamegetParameterTypeNamegetPrimitiveSignaturegetResolvedMethodgetRoutineArgIdxgetRoutineArgIdxgetRoutineInfohasVarargsisVarargresolveMethodCallsetNullParameterInfosomeParametersAreNullstripOneArrayLevelthrowNoMethodFoundtoString

Field Detail

isStaticback to summary
private boolean isStatic
receiverback to summary
pack-priv JavaValueNode receiver

Constructor Detail

NonStaticMethodCallNodeback to summary
pack-priv NonStaticMethodCallNode(String methodName, ValueNode receiver, ContextManager cm) throws StandardException

Constructor for a NonStaticMethodCallNode

Parameters
methodName:String

The name of the method to call

receiver:ValueNode

A JavaValueNode representing the receiving object

cm:ContextManager

The context manager

Exceptions
StandardException:
Thrown on error

Method Detail

acceptChildrenback to summary
pack-priv void acceptChildren(Visitor v) throws StandardException

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.acceptChildren.

Accept the visitor for all visitable children of this node.

Parameters
v:Visitor

the visitor

Annotations
@Override
Exceptions
StandardException:
on error
bindExpressionback to summary
pack-priv JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates) throws StandardException

Implements abstract org.apache.derby.impl.sql.compile.JavaValueNode.bindExpression.

Bind this expression. This means binding the sub-expressions, as well as figuring out what the return type is for this expression.

Parameters
fromList:FromList

The FROM list for the query this expression is in, for binding columns.

subqueryList:SubqueryList

The subquery list being built as we find SubqueryNodes

aggregates:List<AggregateNode>

The aggregate list being built as we find AggregateNodes

Returns:JavaValueNode

this

Exceptions
StandardException:
Thrown on error
categorizeback to summary
pack-priv boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) throws StandardException

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.categorize.

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.

Parameters
referencedTabs:JBitSet

JBitSet with bit map of referenced FromTables

simplePredsOnly:boolean

Whether or not to consider method calls, field references and conditional nodes when building bit map

Returns:boolean

boolean Whether or not source.expression is a ColumnReference or a VirtualColumnNode.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
generateExpressionback to summary
pack-priv void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException

Implements abstract org.apache.derby.impl.sql.compile.JavaValueNode.generateExpression.

Do code generation for this method call

Parameters
acb:ExpressionClassBuilder

The ExpressionClassBuilder for the class we're generating

mb:MethodBuilder

The method the expression will go into

Exceptions
StandardException:
Thrown on error
generateReceiverback to summary
pack-priv boolean generateReceiver(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException

Overrides org.apache.derby.impl.sql.compile.JavaValueNode.generateReceiver.

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.

Parameters
acb:ExpressionClassBuilder

The ExpressionClassBuilder for the class being built

mb:MethodBuilder

The method the expression will go into

Returns:boolean

true if compiled receiver, false otherwise.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
getOrderableVariantTypeback to summary
pack-priv int getOrderableVariantType() throws StandardException

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.getOrderableVariantType.

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)

Returns:int

The variant type for the underlying expression.

Annotations
@Override
preprocessback to summary
pack-priv void preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.preprocess.

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.

Parameters
numTables:int

Number of tables in the DML Statement

outerFromList:FromList

FromList from outer query block

outerSubqueryList:SubqueryList

SubqueryList from outer query block

outerPredicateList:PredicateList

PredicateList from outer query block

Annotations
@Override
Exceptions
StandardException:
Thrown on error
printSubNodesback to summary
pack-priv void printSubNodes(int depth)

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.printSubNodes.

Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Parameters
depth:int

The depth of this node in the tree

Annotations
@Override
remapColumnReferencesToExpressionsback to summary
pack-priv JavaValueNode remapColumnReferencesToExpressions() throws StandardException

Overrides org.apache.derby.impl.sql.compile.MethodCallNode.remapColumnReferencesToExpressions.

Remap all ColumnReferences in this tree to be clones of the underlying expression.

Returns:JavaValueNode

JavaValueNode The remapped expression tree.

Annotations
@Override
Exceptions
StandardException:
Thrown on error