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

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
JavaValueNode, OrderedColumn, Predicate, PrivilegeNode, QueryTreeNodeVector, ResultSetNode, StatementNode, TableElementNode, TableName, TablePrivilegesNode, ValueNode, WindowNode

public abstract class QueryTreeNode
extends java.lang.Object
implements Visitable

QueryTreeNode is the root class for all query tree nodes. All query tree nodes inherit from QueryTreeNode except for those that extend QueryTreeNodeVector.


Field Summary
static int AUTOINCREMENT_CREATE_MODIFY
           
static int AUTOINCREMENT_INC_INDEX
           
static int AUTOINCREMENT_IS_AUTOINCREMENT_INDEX
           
static int AUTOINCREMENT_START_INDEX
           
private  int beginOffset
           
private  ContextManager cm
           
private  GenericConstantActionFactory constantActionFactory
           
private  int endOffset
           
(package private)  boolean isPrivilegeCollectionRequired
          In Derby SQL Standard Authorization, views, triggers and constraints execute with definer's privileges.
private  LanguageConnectionContext lcc
           
private  int nodeType
           
 
Constructor Summary
QueryTreeNode()
           
 
Method Summary
 Visitable accept(Visitor v)
          Accept a visitor, and call v.visit() on child nodes as necessary.
(package private)  void acceptChildren(Visitor v)
          Accept a visitor on all child nodes.
static void bindOffsetFetch(ValueNode offset, ValueNode fetchFirst)
          Bind the parameters of OFFSET n ROWS and FETCH FIRST n ROWS ONLY, if any.
 DataTypeDescriptor bindRowMultiSet(DataTypeDescriptor originalDTD)
          Bind the UDTs in a table type.
 DataTypeDescriptor bindUserType(DataTypeDescriptor originalDTD)
          Bind a UDT.
 void checkReliability(int fragmentBitMask, java.lang.String fragmentType)
          Bind time logic.
 void checkReliability(java.lang.String fragmentType, int fragmentBitMask)
          Bind time logic.
private static boolean containsInfo(java.lang.String str)
           
 DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)
          Translate a Default node into a default value, given a type descriptor.
private  void createTypeDependency(AliasDescriptor ad)
          Declare a dependency on an ANSI UDT, identified by its AliasDescriptor, and check that you have privilege to use it.
 void createTypeDependency(DataTypeDescriptor dtd)
          Declare a dependency on a type and check that you have privilege to use it.
protected static void debugFlush()
          Flush the debug stream out
static void debugPrint(java.lang.String outputString)
          Print a String for debugging
 void disablePrivilegeCollection()
          Triggers, constraints and views get executed with their definer's privileges and they can exist in the system only if their definers' still have all the privileges to creeate them.
static java.lang.String formatNodeString(java.lang.String nodeString, int depth)
          Format a node that has been converted to a String for printing as part of a tree.
 boolean foundString(java.lang.String[] list, java.lang.String search)
           
protected  void generate(ActivationClassBuilder acb, MethodBuilder mb)
          Do the code generation for this node.
(package private)  void generateAuthorizeCheck(ActivationClassBuilder acb, MethodBuilder mb, int sqlOperation)
          Add an authorization check into the passed in method.
 int getBeginOffset()
          Gets the beginning offset of the SQL substring which this query node represents.
protected  ClassFactory getClassFactory()
          Get the ClassFactory to use with this database.
protected  CompilerContext getCompilerContext()
          Get the CompilerContext
 ContextManager getContextManager()
          Get the current ContextManager.
 java.lang.Object getCursorInfo()
           
 DataDictionary getDataDictionary()
          Get the DataDictionary
 DependencyManager getDependencyManager()
           
 int getEndOffset()
          Gets the ending offset of the SQL substring which this query node represents.
 ExecutionFactory getExecutionFactory()
           
 GenericConstantActionFactory getGenericConstantActionFactory()
          Gets the constant action factory for this database.
protected  int getIntProperty(java.lang.String value, java.lang.String key)
          Get the int value of a Property
protected  LanguageConnectionContext getLanguageConnectionContext()
          Gets the LanguageConnectionContext for this connection.
 NodeFactory getNodeFactory()
          Gets the NodeFactory for this database.
protected  int getNodeType()
           
 ConstantNode getNullNode(DataTypeDescriptor type)
          Get a ConstantNode to represent a typed null value.
 DataTypeDescriptor[] getParameterTypes()
          Parameter info is stored in the compiler context.
 long getRowEstimate()
          Get the optimizer's estimate of the number of rows returned or affected for an optimized QueryTree.
(package private)  SchemaDescriptor getSchemaDescriptor(java.lang.String schemaName)
          Get the descriptor for the named schema.
(package private)  SchemaDescriptor getSchemaDescriptor(java.lang.String schemaName, boolean raiseError)
          Get the descriptor for the named schema.
protected  int getStatementType()
          Return the type of statement, something from StatementType.
protected  TableDescriptor getTableDescriptor(java.lang.String tableName, SchemaDescriptor schema)
          Get the descriptor for the named table within the given schema.
protected  TypeCompiler getTypeCompiler(TypeId typeId)
          Get the TypeCompiler associated with the given TypeId
 void init(java.lang.Object arg1)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8, java.lang.Object arg9)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8, java.lang.Object arg9, java.lang.Object arg10)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8, java.lang.Object arg9, java.lang.Object arg10, java.lang.Object arg11)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8, java.lang.Object arg9, java.lang.Object arg10, java.lang.Object arg11, java.lang.Object arg12)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8, java.lang.Object arg9, java.lang.Object arg10, java.lang.Object arg11, java.lang.Object arg12, java.lang.Object arg13)
          Initialize a query tree node.
 void init(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7, java.lang.Object arg8, java.lang.Object arg9, java.lang.Object arg10, java.lang.Object arg11, java.lang.Object arg12, java.lang.Object arg13, java.lang.Object arg14)
          Initialize a query tree node.
 boolean isAtomic()
           
protected  boolean isInstanceOf(int nodeType)
          For final nodes, return whether or not the node represents the specified nodeType.
 boolean isPrivilegeCollectionRequired()
          Return true from this method means that we need to collect privilege requirement for this node.
(package private)  boolean isSessionSchema(SchemaDescriptor sd)
          Checks if the passed schema descriptor is for SESSION schema
(package private)  boolean isSessionSchema(java.lang.String schemaName)
          Checks if the passed schema name is for SESSION schema
 ConstantAction makeConstantAction()
          This creates a class that will do the work that's constant across all Executions of a PreparedStatement.
static TableName makeTableName(NodeFactory nodeFactory, ContextManager contextManager, java.lang.String schemaName, java.lang.String flatName)
           
 TableName makeTableName(java.lang.String schemaName, java.lang.String flatName)
           
protected  java.lang.String nodeHeader()
          Return header information for debug printing of this query tree node.
 int orReliability(int newBits)
          OR in more reliability bits and return the old reliability value.
(package private)  StatementNode parseStatement(java.lang.String sql, boolean internalSQL)
          Parse the a SQL statement from the body of another SQL statement.
 void printLabel(int depth, java.lang.String label)
          Print the given label at the given indentation depth.
 void printSubNodes(int depth)
          Print the sub-nodes of this node.
 boolean referencesSessionSchema()
          Return true if the node references SESSION schema tables (temporary or permanent)
 TableName resolveTableToSynonym(TableName tabName)
          Resolve table/view reference to a synonym.
 void setBeginOffset(int beginOffset)
          Sets the beginning offset of the SQL substring which this query node represents.
 void setContextManager(ContextManager cm)
          Set the ContextManager for this node.
 void setEndOffset(int endOffset)
          Sets the ending offset of the SQL substring which this query node represents.
 void setNodeType(int nodeType)
          Set the node type for this node.
 void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, java.lang.String parentResultSetId, boolean dependentScan)
          set the Information gathered from the parent table that is required to peform a referential action on dependent table.
 void stackPrint()
          Print call stack for debug purposes
private  void throwReliabilityException(java.lang.String fragmentType, int fragmentBitMask)
          Common code for the 2 checkReliability functions.
 java.lang.String toString()
          Format this node as a string Each sub-class of QueryTreeNode should implement its own toString() method.
 void treePrint()
          Print this tree for debugging purposes.
 void treePrint(int depth)
          Print this tree for debugging purposes.
(package private)  void verifyClassExist(java.lang.String javaClassName)
          Verify that a java class exists, is accessible (public) and not a class representing a primitive type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTOINCREMENT_START_INDEX

public static final int AUTOINCREMENT_START_INDEX
See Also:
Constant Field Values

AUTOINCREMENT_INC_INDEX

public static final int AUTOINCREMENT_INC_INDEX
See Also:
Constant Field Values

AUTOINCREMENT_IS_AUTOINCREMENT_INDEX

public static final int AUTOINCREMENT_IS_AUTOINCREMENT_INDEX
See Also:
Constant Field Values

AUTOINCREMENT_CREATE_MODIFY

public static final int AUTOINCREMENT_CREATE_MODIFY
See Also:
Constant Field Values

beginOffset

private int beginOffset

endOffset

private int endOffset

nodeType

private int nodeType

cm

private ContextManager cm

lcc

private LanguageConnectionContext lcc

constantActionFactory

private GenericConstantActionFactory constantActionFactory

isPrivilegeCollectionRequired

boolean isPrivilegeCollectionRequired
In Derby SQL Standard Authorization, views, triggers and constraints execute with definer's privileges. Taking a specific eg of views user1 create table t1 (c11 int); create view v1 as select * from user1.t1; grant select on v1 to user2; user2 select * from user1.v1; Running with definer's privileges mean that since user2 has select privileges on view v1 owned by user1, then that is sufficient for user2 to do a select from view v1. View v1 underneath might access some objects that user2 doesn't have privileges on, but that is not a problem since views execute with definer's privileges. In order to implement this behavior, when doing a select from view v1, we only want to check for select privilege on view v1. While processing the underlying query for view v1, we want to stop collecting the privilege requirements for the query underneath. Following flag, isPrivilegeCollectionRequired is used for this purpose. The flag will be true when we are the top level of view and then it is turned off while we process the query underlying the view v1.

Constructor Detail

QueryTreeNode

public QueryTreeNode()
Method Detail

setContextManager

public void setContextManager(ContextManager cm)
Set the ContextManager for this node.

Parameters:
cm - The ContextManager.

getContextManager

public final ContextManager getContextManager()
Get the current ContextManager.

Returns:
The current ContextManager.

getNodeFactory

public final NodeFactory getNodeFactory()
Gets the NodeFactory for this database.

Returns:
the node factory for this database.

getGenericConstantActionFactory

public final GenericConstantActionFactory getGenericConstantActionFactory()
Gets the constant action factory for this database.

Returns:
the constant action factory.

getExecutionFactory

public final ExecutionFactory getExecutionFactory()

getClassFactory

protected final ClassFactory getClassFactory()
Get the ClassFactory to use with this database.


getLanguageConnectionContext

protected final LanguageConnectionContext getLanguageConnectionContext()
Gets the LanguageConnectionContext for this connection.

Returns:
the lcc for this connection

getBeginOffset

public int getBeginOffset()
Gets the beginning offset of the SQL substring which this query node represents.

Returns:
The beginning offset of the SQL substring. -1 means unknown.

setBeginOffset

public void setBeginOffset(int beginOffset)
Sets the beginning offset of the SQL substring which this query node represents.

Parameters:
beginOffset - The beginning offset of the SQL substring.

getEndOffset

public int getEndOffset()
Gets the ending offset of the SQL substring which this query node represents.

Returns:
The ending offset of the SQL substring. -1 means unknown.

setEndOffset

public void setEndOffset(int endOffset)
Sets the ending offset of the SQL substring which this query node represents.

Parameters:
endOffset - The ending offset of the SQL substring.

nodeHeader

protected java.lang.String nodeHeader()
Return header information for debug printing of this query tree node.

Returns:
Header information for debug printing of this query tree node.

formatNodeString

public static java.lang.String formatNodeString(java.lang.String nodeString,
                                                int depth)
Format a node that has been converted to a String for printing as part of a tree. This method indents the String to the given depth by inserting tabs at the beginning of the string, and also after every newline.

Parameters:
nodeString - The node formatted as a String
depth - The depth to indent the given node
Returns:
The node String reformatted with tab indentation

treePrint

public void treePrint()
Print this tree for debugging purposes. This recurses through all the sub-nodes and prints them indented by their depth in the tree.


stackPrint

public void stackPrint()
Print call stack for debug purposes


treePrint

public void treePrint(int depth)
Print this tree for debugging purposes. This recurses through all the sub-nodes and prints them indented by their depth in the tree, starting with the given indentation.

Parameters:
depth - The depth of this node in the tree, thus, the amount to indent it when printing it.

containsInfo

private static boolean containsInfo(java.lang.String str)

debugPrint

public static void debugPrint(java.lang.String outputString)
Print a String for debugging

Parameters:
outputString - The String to print

debugFlush

protected static void debugFlush()
Flush the debug stream out


printSubNodes

public void printSubNodes(int depth)
Print the sub-nodes of this node. Each sub-class of QueryTreeNode is expected to provide its own printSubNodes() method. In each case, it calls super.printSubNodes(), passing along its depth, to get the sub-nodes of the super-class. Then it prints its own sub-nodes by calling treePrint() on each of its members that is a type of QueryTreeNode. In each case where it calls treePrint(), it should pass "depth + 1" to indicate that the sub-node should be indented one more level when printing. Also, it should call printLabel() to print the name of each sub-node before calling treePrint() on the sub-node, so that the reader of the printed tree can tell what the sub-node is. This printSubNodes() exists in here merely to act as a backstop. In other words, the calls to printSubNodes() move up the type hierarchy, and in this node the calls stop. I would have liked to put the call to super.printSubNodes() in this super-class, but Java resolves "super" statically, so it wouldn't get to the right super-class.

Parameters:
depth - The depth to indent the sub-nodes

toString

public java.lang.String toString()
Format this node as a string Each sub-class of QueryTreeNode should implement its own toString() method. In each case, toString() should format the class members that are not sub-types of QueryTreeNode (printSubNodes() takes care of following the references to sub-nodes, and toString() takes care of all members that are not sub-nodes). Newlines should be used liberally - one good way to do this is to have a newline at the end of each formatted member. It's also a good idea to put the name of each member in front of the formatted value. For example, the code might look like: "memberName: " + memberName + "\n" + ... Vector members containing subclasses of QueryTreeNode should subclass QueryTreeNodeVector. Such subclasses form a special case: These classes should not implement printSubNodes, since there is generic handling in QueryTreeNodeVector. They should only implement toString if they contain additional members.

Overrides:
toString in class java.lang.Object
Returns:
This node formatted as a String

printLabel

public void printLabel(int depth,
                       java.lang.String label)
Print the given label at the given indentation depth.

Parameters:
depth - The depth of indentation to use when printing the label
label - The String to print

referencesSessionSchema

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

Returns:
true if references SESSION schema tables, else false
Throws:
StandardException - Thrown on error

isSessionSchema

final boolean isSessionSchema(SchemaDescriptor sd)
Checks if the passed schema descriptor is for SESSION schema

Returns:
true if the passed schema descriptor is for SESSION schema
Throws:
StandardException - Thrown on error

isSessionSchema

final boolean isSessionSchema(java.lang.String schemaName)
Checks if the passed schema name is for SESSION schema

Returns:
true if the passed schema name is for SESSION schema
Throws:
StandardException - Thrown on error

disablePrivilegeCollection

public void disablePrivilegeCollection()
Triggers, constraints and views get executed with their definer's privileges and they can exist in the system only if their definers' still have all the privileges to creeate them. Based on this, any time a trigger/view/constraint is executing, we do not need to waste time in checking if the definer still has the right set of privileges. At compile time, we wil make sure that we do not collect the privilege requirement for objects accessed with definer privileges by calling the following method.


isPrivilegeCollectionRequired

public boolean isPrivilegeCollectionRequired()
Return true from this method means that we need to collect privilege requirement for this node. For following cases, this method will return true. 1)execute view - collect privilege to access view but do not collect privilege requirements for objects accessed by actual view uqery 2)execute select - collect privilege requirements for objects accessed by select statement 3)create view - collect privileges for select statement : the select statement for create view falls under 2) category above.

Returns:
true if need to collect privilege requirement for this node

getRowEstimate

public long getRowEstimate()
Get the optimizer's estimate of the number of rows returned or affected for an optimized QueryTree. For non-optimizable statements (for example, CREATE TABLE), return 0. For optimizable statements, this method will be over-ridden in the statement's root node (DMLStatementNode in all cases we know about so far).

Returns:
0L

generate

protected void generate(ActivationClassBuilder acb,
                        MethodBuilder mb)
                 throws StandardException
Do the code generation for this node. This is a place-holder method - it should be over-ridden in the sub-classes.

Parameters:
acb - The ActivationClassBuilder for the class being built
mb - The method for the generated code to go into
Throws:
StandardException - Thrown on error

getParameterTypes

public DataTypeDescriptor[] getParameterTypes()
                                       throws StandardException
Parameter info is stored in the compiler context. Hide this from the callers.

Returns:
null
Throws:
StandardException - on error

makeConstantAction

public ConstantAction makeConstantAction()
                                  throws StandardException
This creates a class that will do the work that's constant across all Executions of a PreparedStatement. It's up to our subclasses to override this method if they need to compile constant actions into PreparedStatements.

Throws:
StandardException - Thrown on failure

setNodeType

public void setNodeType(int nodeType)
Set the node type for this node.

Parameters:
nodeType - The node type.

getNodeType

protected int getNodeType()

isInstanceOf

protected boolean isInstanceOf(int nodeType)
For final nodes, return whether or not the node represents the specified nodeType.

Parameters:
nodeType - The nodeType of interest.
Returns:
Whether or not the node represents the specified nodeType.

getDataDictionary

public final DataDictionary getDataDictionary()
Get the DataDictionary

Returns:
The DataDictionary

getDependencyManager

public final DependencyManager getDependencyManager()

getCompilerContext

protected final CompilerContext getCompilerContext()
Get the CompilerContext

Returns:
The CompilerContext

getTypeCompiler

protected final TypeCompiler getTypeCompiler(TypeId typeId)
Get the TypeCompiler associated with the given TypeId

Parameters:
typeId - The TypeId to get a TypeCompiler for
Returns:
The corresponding TypeCompiler

accept

public final Visitable accept(Visitor v)
                       throws StandardException
Accept a visitor, and call v.visit() on child nodes as necessary. Sub-classes should not override this method, but instead override the acceptChildren(Visitor) method.

Specified by:
accept in interface Visitable
Parameters:
v - the visitor
Throws:
StandardException - on error

acceptChildren

void acceptChildren(Visitor v)
              throws StandardException
Accept a visitor on all child nodes. All sub-classes that add fields that should be visited, should override this method and call accept(v) on all visitable fields, as well as super.acceptChildren(v) to make sure all visitable fields defined by the super-class are accepted too.

Parameters:
v - the visitor
Throws:
StandardException - on errors raised by the visitor

getIntProperty

protected int getIntProperty(java.lang.String value,
                             java.lang.String key)
                      throws StandardException
Get the int value of a Property

Parameters:
value - Property value as a String
key - Key value of property
Returns:
The int value of the property
Throws:
StandardException - Thrown on failure

parseStatement

StatementNode parseStatement(java.lang.String sql,
                             boolean internalSQL)
                       throws StandardException
Parse the a SQL statement from the body of another SQL statement. Pushes and pops a separate CompilerContext to perform the compilation.

Throws:
StandardException

getStatementType

protected int getStatementType()
Return the type of statement, something from StatementType.

Returns:
the type of statement

foundString

public boolean foundString(java.lang.String[] list,
                           java.lang.String search)

getNullNode

public ConstantNode getNullNode(DataTypeDescriptor type)
                         throws StandardException
Get a ConstantNode to represent a typed null value.

Parameters:
type - Type of the null node.
Returns:
A ConstantNode with the specified type, and a value of null
Throws:
StandardException - Thrown on error

convertDefaultNode

public DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)
                                       throws StandardException
Translate a Default node into a default value, given a type descriptor.

Parameters:
typeDescriptor - A description of the required data type.
Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8,
                 java.lang.Object arg9)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8,
                 java.lang.Object arg9,
                 java.lang.Object arg10)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8,
                 java.lang.Object arg9,
                 java.lang.Object arg10,
                 java.lang.Object arg11)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8,
                 java.lang.Object arg9,
                 java.lang.Object arg10,
                 java.lang.Object arg11,
                 java.lang.Object arg12)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8,
                 java.lang.Object arg9,
                 java.lang.Object arg10,
                 java.lang.Object arg11,
                 java.lang.Object arg12,
                 java.lang.Object arg13)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2,
                 java.lang.Object arg3,
                 java.lang.Object arg4,
                 java.lang.Object arg5,
                 java.lang.Object arg6,
                 java.lang.Object arg7,
                 java.lang.Object arg8,
                 java.lang.Object arg9,
                 java.lang.Object arg10,
                 java.lang.Object arg11,
                 java.lang.Object arg12,
                 java.lang.Object arg13,
                 java.lang.Object arg14)
          throws StandardException
Initialize a query tree node.

Throws:
StandardException - Thrown on error

makeTableName

public TableName makeTableName(java.lang.String schemaName,
                               java.lang.String flatName)
                        throws StandardException
Throws:
StandardException

makeTableName

public static TableName makeTableName(NodeFactory nodeFactory,
                                      ContextManager contextManager,
                                      java.lang.String schemaName,
                                      java.lang.String flatName)
                               throws StandardException
Throws:
StandardException

isAtomic

public boolean isAtomic()
                 throws StandardException
Throws:
StandardException

getCursorInfo

public java.lang.Object getCursorInfo()
                               throws StandardException
Throws:
StandardException

getTableDescriptor

protected final TableDescriptor getTableDescriptor(java.lang.String tableName,
                                                   SchemaDescriptor schema)
                                            throws StandardException
Get the descriptor for the named table within the given schema. If the schema parameter is NULL, it looks for the table in the current (default) schema. Table descriptors include object ids, object types (table, view, etc.) If the schema is SESSION, then before looking into the data dictionary for persistent tables, it first looks into LCC for temporary tables. If no temporary table tableName found for the SESSION schema, then it goes and looks through the data dictionary for persistent table We added getTableDescriptor here so that we can look for non data dictionary tables(ie temp tables) here. Any calls to getTableDescriptor in data dictionary should be only for persistent tables

Parameters:
tableName - The name of the table to get the descriptor for
schema - The descriptor for the schema the table lives in. If null, use the current (default) schema.
Returns:
The descriptor for the table, null if table does not exist.
Throws:
StandardException - Thrown on failure

getSchemaDescriptor

final SchemaDescriptor getSchemaDescriptor(java.lang.String schemaName)
                                    throws StandardException
Get the descriptor for the named schema. If the schemaName parameter is NULL, it gets the descriptor for the current compilation schema. QueryTreeNodes must obtain schemas using this method or the two argument version of it. This is to ensure that the correct default compliation schema is returned and to allow determination of if the statement being compiled depends on the current schema. Schema descriptors include authorization ids and schema ids. SQL92 allows a schema to specify a default character set - we will not support this. Will check default schema for a match before scanning a system table.

Parameters:
schemaName - The name of the schema we're interested in. If the name is NULL, get the descriptor for the current compilation schema.
Returns:
The descriptor for the schema.
Throws:
StandardException - Thrown on error

getSchemaDescriptor

final SchemaDescriptor getSchemaDescriptor(java.lang.String schemaName,
                                           boolean raiseError)
                                    throws StandardException
Get the descriptor for the named schema. If the schemaName parameter is NULL, it gets the descriptor for the current compilation schema. QueryTreeNodes must obtain schemas using this method or the single argument version of it. This is to ensure that the correct default compliation schema is returned and to allow determination of if the statement being compiled depends on the current schema.

Parameters:
schemaName - The name of the schema we're interested in. If the name is NULL, get the descriptor for the current compilation schema.
raiseError - True to raise an error if the schema does not exist, false to return null if the schema does not exist.
Returns:
Valid SchemaDescriptor or null if raiseError is false and the schema does not exist.
Throws:
StandardException - Schema does not exist and raiseError is true.

resolveTableToSynonym

public TableName resolveTableToSynonym(TableName tabName)
                                throws StandardException
Resolve table/view reference to a synonym. May have to follow a synonym chain.

Parameters:
tabName - to match for a synonym
Returns:
Synonym TableName if a match is found, NULL otherwise.
Throws:
StandardException - Thrown on error

verifyClassExist

void verifyClassExist(java.lang.String javaClassName)
                throws StandardException
Verify that a java class exists, is accessible (public) and not a class representing a primitive type.

Parameters:
javaClassName - The name of the java class to resolve.
Throws:
StandardException - Thrown on error

setRefActionInfo

public void setRefActionInfo(long fkIndexConglomId,
                             int[] fkColArray,
                             java.lang.String parentResultSetId,
                             boolean dependentScan)
set the Information gathered from the parent table that is required to peform a referential action on dependent table.


generateAuthorizeCheck

void generateAuthorizeCheck(ActivationClassBuilder acb,
                            MethodBuilder mb,
                            int sqlOperation)
Add an authorization check into the passed in method.


checkReliability

public void checkReliability(java.lang.String fragmentType,
                             int fragmentBitMask)
                      throws StandardException
Bind time logic. Raises an error if this ValueNode, once compiled, returns unstable results AND if we're in a context where unstable results are forbidden. Called by children who may NOT appear in the WHERE subclauses of ADD TABLE clauses.

Parameters:
fragmentType - Type of fragment as a String, for inclusion in error messages.
fragmentBitMask - Type of fragment as a bitmask of possible fragment types
Throws:
StandardException - Thrown on error

checkReliability

public void checkReliability(int fragmentBitMask,
                             java.lang.String fragmentType)
                      throws StandardException
Bind time logic. Raises an error if this ValueNode, once compiled, returns unstable results AND if we're in a context where unstable results are forbidden. Called by children who may NOT appear in the WHERE subclauses of ADD TABLE clauses.

Parameters:
fragmentBitMask - Type of fragment as a bitmask of possible fragment types
fragmentType - Type of fragment as a String, to be fetch for the error message.
Throws:
StandardException - Thrown on error

bindUserType

public DataTypeDescriptor bindUserType(DataTypeDescriptor originalDTD)
                                throws StandardException
Bind a UDT. This involves looking it up in the DataDictionary and filling in its class name.

Parameters:
originalDTD - A datatype: might be an unbound UDT and might not be
Returns:
The bound UDT if originalDTD was an unbound UDT; otherwise returns originalDTD.
Throws:
StandardException

bindRowMultiSet

public DataTypeDescriptor bindRowMultiSet(DataTypeDescriptor originalDTD)
                                   throws StandardException
Bind the UDTs in a table type.

Parameters:
originalDTD - A datatype: might be an unbound UDT and might not be
Returns:
The bound table type if originalDTD was an unbound table type; otherwise returns originalDTD.
Throws:
StandardException

createTypeDependency

public void createTypeDependency(DataTypeDescriptor dtd)
                          throws StandardException
Declare a dependency on a type and check that you have privilege to use it. This is only used if the type is an ANSI UDT.

Parameters:
dtd - Type which may have a dependency declared on it.
Throws:
StandardException

createTypeDependency

private void createTypeDependency(AliasDescriptor ad)
                           throws StandardException
Declare a dependency on an ANSI UDT, identified by its AliasDescriptor, and check that you have privilege to use it.

Throws:
StandardException

throwReliabilityException

private void throwReliabilityException(java.lang.String fragmentType,
                                       int fragmentBitMask)
                                throws StandardException
Common code for the 2 checkReliability functions. Always throws StandardException.

Parameters:
fragmentType - Type of fragment as a string, for inclusion in error messages.
fragmentBitMask - Describes the kinds of expressions we ar suspicious of
Throws:
StandardException - Throws an error, always.

orReliability

public int orReliability(int newBits)
OR in more reliability bits and return the old reliability value.


bindOffsetFetch

public static void bindOffsetFetch(ValueNode offset,
                                   ValueNode fetchFirst)
                            throws StandardException
Bind the parameters of OFFSET n ROWS and FETCH FIRST n ROWS ONLY, if any.

Parameters:
offset - the OFFSET parameter, if any
fetchFirst - the FETCH parameter, if any
Throws:
StandardException - Thrown on error

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

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