org.exolab.castor.jdo.oql
Class ParseTreeWalker

java.lang.Object
  extended by org.exolab.castor.jdo.oql.ParseTreeWalker

public class ParseTreeWalker
extends java.lang.Object

A class which walks the parse tree created by the parser to check for errors and translate to SQL.

Version:
$Revision: 8459 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Nissim Karpenstein

Field Summary
static int AGGREGATE
           
static int DEPENDANT_OBJECT
           
static int DEPENDANT_OBJECT_VALUE
           
static int DEPENDANT_VALUE
           
static int FUNCTION
           
static int MAX_TABLE_LENGTH
           
static int PARENT_OBJECT
           
 
Constructor Summary
ParseTreeWalker(LockEngine dbEngine, ParseTreeNode parseTree, java.lang.ClassLoader classLoader, DbMetaInfo dbInfo)
          Creates a new parse tree walker.
 
Method Summary
 java.lang.String buildTableAlias(java.lang.String tableName, java.util.Vector<java.lang.String> path, int tableIndex)
          Builds the alias name for a table from the path info.
 ClassDescriptor getClassDescriptor()
          Accessor method for _clsDesc.
 java.lang.Class<?> getObjClass()
          Accessor method for _objClass.
 java.util.Hashtable<java.lang.Integer,ParamInfo> getParamInfo()
          Accessor method for _paramInfo.
 java.util.Vector<java.lang.String> getProjectionInfo()
          Method to get path info for the selected object.
 int getProjectionType()
          Accessor method for _projectionType.
 QueryExpression getQueryExpression()
          Accessor method for private _queryExpr member.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AGGREGATE

public static final int AGGREGATE
See Also:
Constant Field Values

FUNCTION

public static final int FUNCTION
See Also:
Constant Field Values

PARENT_OBJECT

public static final int PARENT_OBJECT
See Also:
Constant Field Values

DEPENDANT_OBJECT

public static final int DEPENDANT_OBJECT
See Also:
Constant Field Values

DEPENDANT_OBJECT_VALUE

public static final int DEPENDANT_OBJECT_VALUE
See Also:
Constant Field Values

DEPENDANT_VALUE

public static final int DEPENDANT_VALUE
See Also:
Constant Field Values

MAX_TABLE_LENGTH

public static final int MAX_TABLE_LENGTH
See Also:
Constant Field Values
Constructor Detail

ParseTreeWalker

public ParseTreeWalker(LockEngine dbEngine,
                       ParseTreeNode parseTree,
                       java.lang.ClassLoader classLoader,
                       DbMetaInfo dbInfo)
                throws QueryException
Creates a new parse tree walker. Which checks the tree for errors, and generates a QueryExpression containing the SQL translation.

Parameters:
dbEngine - The Persistence Engine
parseTree - The parse tree to walk
classLoader - A ClassLoader instance to load classes.
Throws:
QueryException - Thrown by checkErrors.
Method Detail

getObjClass

public java.lang.Class<?> getObjClass()
Accessor method for _objClass.

Returns:
The _objClass member.

getProjectionType

public int getProjectionType()
Accessor method for _projectionType.

Returns:
The _projectionType member.

getQueryExpression

public QueryExpression getQueryExpression()
Accessor method for private _queryExpr member.

Returns:
private _queryExpr member

getParamInfo

public java.util.Hashtable<java.lang.Integer,ParamInfo> getParamInfo()
Accessor method for _paramInfo.

Returns:
The _paramInfo member.

getClassDescriptor

public ClassDescriptor getClassDescriptor()
Accessor method for _clsDesc.

Returns:
The _clsDesc member.

getProjectionInfo

public java.util.Vector<java.lang.String> getProjectionInfo()
Method to get path info for the selected object. This is the path which will be used by the QueryResults to follow the path if the object selected is a DEPENDANT_OBJECT or DEPENDANT_OBJECT_VALUE. Any other projectionTypes do not need this, so null will be returned.

Returns:
Path info for the selected element, null otherwise.

buildTableAlias

public java.lang.String buildTableAlias(java.lang.String tableName,
                                        java.util.Vector<java.lang.String> path,
                                        int tableIndex)
Builds the alias name for a table from the path info.

Parameters:
tableName - The name of the table to add to the select clause
path - The path info vector to build the alias with
tableIndex - Field index in the path info
Returns:
Alias name for a given table.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com