java.lang.Object
org.apache.derby.impl.sql.compile.HasVariantValueNodeVisitor
- All Implemented Interfaces:
- org.apache.derby.iapi.sql.compile.Visitor
- public class HasVariantValueNodeVisitor
- extends java.lang.Object
- implements org.apache.derby.iapi.sql.compile.Visitor
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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hasVariant
private boolean hasVariant
variantType
private int variantType
ignoreParameters
private boolean ignoreParameters
HasVariantValueNodeVisitor
public HasVariantValueNodeVisitor()
- Construct a visitor
HasVariantValueNodeVisitor
public 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.
visit
public org.apache.derby.iapi.sql.compile.Visitable visit(org.apache.derby.iapi.sql.compile.Visitable node)
throws org.apache.derby.iapi.error.StandardException
- If we have found the target node, we are done.
- Specified by:
visit in interface org.apache.derby.iapi.sql.compile.Visitor
skipChildren
public boolean skipChildren(org.apache.derby.iapi.sql.compile.Visitable node)
- Description copied from interface:
org.apache.derby.iapi.sql.compile.Visitor
- 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.
- Specified by:
skipChildren in interface org.apache.derby.iapi.sql.compile.Visitor
stopTraversal
public boolean stopTraversal()
- Stop traversal if we found the target node
- Specified by:
stopTraversal in interface org.apache.derby.iapi.sql.compile.Visitor
hasVariant
public boolean hasVariant()
- Indicate whether we found the node in
question