org.exolab.castor.jdo.oql

Class 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: 5951 $ $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, ClassLoader classLoader, DbMetaInfo dbInfo)
Creates a new parse tree walker.

Method Summary

String
buildTableAlias(String tableName, Vector path, int tableIndex)
Builds the alias name for a table from the path info.
JDOClassDescriptor
getClassDescriptor()
Accessor method for _clsDesc.
Class
getObjClass()
Accessor method for _objClass.
Hashtable
getParamInfo()
Accessor method for _paramInfo.
Vector
getProjectionInfo()
Method to get path info for the selected object.
int
getProjectionType()
Accessor method for _projectionType.
QueryExpression
getQueryExpression()
Accessor method for private _queryExpr member.

Field Details

AGGREGATE

public static final int AGGREGATE
Field Value:
1

DEPENDANT_OBJECT

public static final int DEPENDANT_OBJECT
Field Value:
4

DEPENDANT_OBJECT_VALUE

public static final int DEPENDANT_OBJECT_VALUE
Field Value:
5

DEPENDANT_VALUE

public static final int DEPENDANT_VALUE
Field Value:
6

FUNCTION

public static final int FUNCTION
Field Value:
2

MAX_TABLE_LENGTH

public static final int MAX_TABLE_LENGTH
Field Value:
30

PARENT_OBJECT

public static final int PARENT_OBJECT
Field Value:
3

Constructor Details

ParseTreeWalker

public ParseTreeWalker(LockEngine dbEngine,
                       ParseTreeNode parseTree,
                       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 Details

buildTableAlias

public String buildTableAlias(String tableName,
                              Vector 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.

getClassDescriptor

public JDOClassDescriptor getClassDescriptor()
Accessor method for _clsDesc.
Returns:
The _clsDesc member.

getObjClass

public Class getObjClass()
Accessor method for _objClass.
Returns:
The _objClass member.

getParamInfo

public Hashtable getParamInfo()
Accessor method for _paramInfo.
Returns:
The _paramInfo member.

getProjectionInfo

public Vector 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.

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

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