org.apache.derby.impl.sql.compile
Class VTIDeferModPolicy

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.VTIDeferModPolicy
All Implemented Interfaces:
Visitor

class VTIDeferModPolicy
extends java.lang.Object
implements Visitor

This class applies a VTI modification deferral policy to a statement to see whether it should be deferred.


Field Summary
private  java.util.Hashtable columns
           
private  DeferModification deferralControl
           
private  boolean deferred
           
private  int statementType
           
private  int tableNumber
           
 
Constructor Summary
private VTIDeferModPolicy(FromVTI targetVTI, java.lang.String[] columnNames, DeferModification deferralControl, int statementType)
           
 
Method Summary
static boolean deferIt(int statementType, FromVTI targetVTI, java.lang.String[] updateColumnNames, QueryTreeNode source)
          See if a VTI modification statement should be deferred.
 boolean skipChildren(Visitable node)
          Method that is called to indicate whether we should skip all nodes below this node for traversal.
 boolean stopTraversal()
          Method that is called to see if query tree traversal should be stopped before visiting all nodes.
 Visitable visit(Visitable node)
          This is the default visit operation on a QueryTreeNode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

deferred

private boolean deferred

deferralControl

private DeferModification deferralControl

statementType

private int statementType

tableNumber

private int tableNumber

columns

private java.util.Hashtable columns
Constructor Detail

VTIDeferModPolicy

private VTIDeferModPolicy(FromVTI targetVTI,
                          java.lang.String[] columnNames,
                          DeferModification deferralControl,
                          int statementType)
Method Detail

deferIt

public static boolean deferIt(int statementType,
                              FromVTI targetVTI,
                              java.lang.String[] updateColumnNames,
                              QueryTreeNode source)
                       throws StandardException
See if a VTI modification statement should be deferred.

Parameters:
statementType - DeferModification.INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT
targetVTI - The target VTI
updateColumnNames - The list of columns being updated, null if this is not an update statement
source -
Throws:
StandardException

visit

public Visitable visit(Visitable node)
                throws StandardException
Description copied from interface: Visitor
This is the default visit operation on a QueryTreeNode. It just returns the node. This will typically suffice as the default visit operation for most visitors unless the visitor needs to count the number of nodes visited or something like that.

Visitors will overload this method by implementing a version with a signature that matches a specific type of node. For example, if I want to do something special with aggregate nodes, then that Visitor will implement a visit(AggregateNode node) method which does the aggregate specific processing.

Specified by:
visit in interface Visitor
Parameters:
node - the node to process
Returns:
a query tree node. Often times this is the same node that was passed in, but Visitors that replace nodes with other nodes will use this to return the new replacement node.
Throws:
StandardException - may be throw an error as needed by the visitor (i.e. may be a normal error if a particular node is found, e.g. if checking a group by, we don't expect to find any ColumnReferences that aren't under an AggregateNode -- the easiest thing to do is just throw an error when we find the questionable node).

stopTraversal

public boolean stopTraversal()
Description copied from interface: Visitor
Method that is called to see if query tree traversal should be stopped before visiting all nodes. Useful for short circuiting traversal if we already know we are done.

Specified by:
stopTraversal in interface Visitor
Returns:
true/false

skipChildren

public boolean skipChildren(Visitable node)
Description copied from interface: 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 Visitor
Parameters:
node - the node to process
Returns:
true/false


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.