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

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.QueryTreeNodeVector
          extended by org.apache.derby.impl.sql.compile.SubqueryList
All Implemented Interfaces:
Visitable

public class SubqueryList
extends QueryTreeNodeVector

A SubqueryList represents a list of subquerys within a specific clause (select, where or having) in a DML statement. It extends QueryTreeNodeVector.


Field Summary
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
 
Constructor Summary
SubqueryList()
           
 
Method Summary
 void addSubqueryNode(SubqueryNode subqueryNode)
          Add a subquery to the list.
(package private)  void decrementLevel(int decrement)
          Decrement (query block) level (0-based) for all of the tables in this subquery list.
 void markHavingSubqueries()
          Mark all of the subqueries in this list as being part of a having clause, so we can avoid flattenning later.
 void markWhereSubqueries()
          Mark all of the subqueries in this list as being part of a where clause so we can avoid flattening later if needed.
 void modifyAccessPaths()
          Modify the access paths for all subqueries in this list.
 void optimize(DataDictionary dataDictionary, double outerRows)
          Optimize the subqueries in this list.
 void preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList)
          Preprocess a SubqueryList.
 boolean referencesSessionSchema()
          Return true if the node references SESSION schema tables (temporary or permanent)
 boolean referencesTarget(java.lang.String name, boolean baseTable)
          Search to see if a query references the specifed table name.
 void setPointOfAttachment(int pointOfAttachment)
          Set the point of attachment in all subqueries in this list.
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNodeVector
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, nondestructiveAppend, printSubNodes, remove, removeAllElements, removeElement, removeElementAt, setElementAt, size
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, toString, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubqueryList

public SubqueryList()
Method Detail

addSubqueryNode

public void addSubqueryNode(SubqueryNode subqueryNode)
                     throws StandardException
Add a subquery to the list.

Parameters:
subqueryNode - A SubqueryNode to add to the list
Throws:
StandardException

preprocess

public void preprocess(int numTables,
                       FromList outerFromList,
                       SubqueryList outerSubqueryList,
                       PredicateList outerPredicateList)
                throws StandardException
Preprocess a SubqueryList. For now, we just preprocess each SubqueryNode in the list.

Parameters:
numTables - Number of tables in the DML Statement
outerFromList - FromList from outer query block
outerSubqueryList - SubqueryList from outer query block
outerPredicateList - PredicateList from outer query block
Throws:
StandardException - Thrown on error

optimize

public void optimize(DataDictionary dataDictionary,
                     double outerRows)
              throws StandardException
Optimize the subqueries in this list.

Parameters:
dataDictionary - The data dictionary to use for optimization
outerRows - The optimizer's estimate of the number of times this subquery will be executed.
Throws:
StandardException - Thrown on error

modifyAccessPaths

public void modifyAccessPaths()
                       throws StandardException
Modify the access paths for all subqueries in this list.

Throws:
StandardException - Thrown on error
See Also:
ResultSetNode.modifyAccessPaths()

referencesTarget

public boolean referencesTarget(java.lang.String name,
                                boolean baseTable)
                         throws StandardException
Search to see if a query references the specifed table name.

Parameters:
name - Table name (String) to search for.
baseTable - Whether or not name is for a base table
Returns:
true if found, else false
Throws:
StandardException - Thrown on error

referencesSessionSchema

public boolean referencesSessionSchema()
                                throws StandardException
Return true if the node references SESSION schema tables (temporary or permanent)

Overrides:
referencesSessionSchema in class QueryTreeNode
Returns:
true if references SESSION schema tables, else false
Throws:
StandardException - Thrown on error

setPointOfAttachment

public void setPointOfAttachment(int pointOfAttachment)
                          throws StandardException
Set the point of attachment in all subqueries in this list.

Parameters:
pointOfAttachment - The point of attachment
Throws:
StandardException - Thrown on error

decrementLevel

void decrementLevel(int decrement)
Decrement (query block) level (0-based) for all of the tables in this subquery list. This is useful when flattening a subquery.

Parameters:
decrement - The amount to decrement by.

markHavingSubqueries

public void markHavingSubqueries()
Mark all of the subqueries in this list as being part of a having clause, so we can avoid flattenning later.


markWhereSubqueries

public void markWhereSubqueries()
Mark all of the subqueries in this list as being part of a where clause so we can avoid flattening later if needed.


Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.