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

pack-priv Class HasVariantValueNodeVisitor

extends Object
implements Visitor
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.compile.Visitor
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.compile.Visitable, .Visitor, org.apache.derby.iapi.store.access.Qualifier

Find out if we have a value node with variant type less than what the caller desires, anywhere below us. Stop traversal as soon as we find one. This is used in two places: one to check the values clause of an insert statement; i.e
insert into  values (?, 1, foobar());

If all the expressions in the values clause are QUERY_INVARIANT (and an
exception is made for parameters) then we can cache the results in the
RowResultNode. This is useful when we have a prepared insert statement which
is repeatedly executed.

The second place where this is used is to check if a subquery can be materialized or not.

See Also
org.apache.derby.iapi.store.access.Qualifier

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private int

Constructor Summary

AccessConstructor and Description
pack-priv
HasVariantValueNodeVisitor()

Construct a visitor

pack-priv
HasVariantValueNodeVisitor(int
the type of variance we consider variant
variantType
,
boolean
should I ignore parameter nodes?
ignoreParameters
)

Construct a visitor.

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean

Returns:

true/false
hasVariant
()

Indicate whether we found the node in question

public boolean
skipChildren(Visitable
the node to process
node
)

Implements org.apache.derby.iapi.sql.compile.Visitor.skipChildren.

Method that is called to indicate whether we should skip all nodes below this node for traversal.

public boolean

Returns:

true/false
stopTraversal
()

Implements org.apache.derby.iapi.sql.compile.Visitor.stopTraversal.

Stop traversal if we found the target node

public Visitable

Returns:

me
visit
(Visitable
the node to process
node
)

Implements org.apache.derby.iapi.sql.compile.Visitor.visit.

If we have found the target node, we are done.

public boolean
visitChildrenFirst(Visitable
the top node of a sub-tree about to be visited
node
)

Implements org.apache.derby.iapi.sql.compile.Visitor.visitChildrenFirst.

Method that is called to see if visit() should be called on the children of node before it is called on node itself.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hasVariantback to summary
private boolean hasVariant
ignoreParametersback to summary
private boolean ignoreParameters
variantTypeback to summary
private int variantType

Constructor Detail

HasVariantValueNodeVisitorback to summary
pack-priv HasVariantValueNodeVisitor()

Construct a visitor

HasVariantValueNodeVisitorback to summary
pack-priv HasVariantValueNodeVisitor(int variantType, boolean ignoreParameters)

Construct a visitor. Pass in the variant type. We look for nodes that are less than or equal to this variant type. E.g., if the variantType is Qualifier.SCAN_VARIANT, then any node that is either VARIANT or SCAN_VARIANT will cause the visitor to consider it variant.

Parameters
variantType:int

the type of variance we consider variant

ignoreParameters:boolean

should I ignore parameter nodes?

Method Detail

hasVariantback to summary
pack-priv boolean hasVariant()

Indicate whether we found the node in question

Returns:boolean

true/false

skipChildrenback to summary
public boolean skipChildren(Visitable node)

Implements org.apache.derby.iapi.sql.compile.Visitor.skipChildren.

Doc from org.apache.derby.iapi.sql.compile.Visitor.skipChildren.

Method that is called to indicate whether we should skip all nodes below this node for traversal. Useful if we want to effectively ignore/prune all branches under a particular node.

Differs from stopTraversal() in that it only affects subtrees, rather than the entire traversal.

Parameters
node:Visitable

the node to process

Returns:boolean

true/false

stopTraversalback to summary
public boolean stopTraversal()

Implements org.apache.derby.iapi.sql.compile.Visitor.stopTraversal.

Stop traversal if we found the target node

Returns:boolean

true/false

visitback to summary
public Visitable visit(Visitable node) throws StandardException

Implements org.apache.derby.iapi.sql.compile.Visitor.visit.

If we have found the target node, we are done.

Parameters
node:Visitable

the node to process

Returns:Visitable

me

Exceptions
StandardException:
on error
visitChildrenFirstback to summary
public boolean visitChildrenFirst(Visitable node)

Implements org.apache.derby.iapi.sql.compile.Visitor.visitChildrenFirst.

Doc from org.apache.derby.iapi.sql.compile.Visitor.visitChildrenFirst.

Method that is called to see if visit() should be called on the children of node before it is called on node itself. If this method always returns true, the visitor will walk the tree bottom-up. If it always returns false, the tree is visited top-down.

Parameters
node:Visitable

the top node of a sub-tree about to be visited

Returns:boolean

true if node's children should be visited before node, false otherwise