org.exolab.castor.jdo.oql

Class ParseTreeWalker

Implemented Interfaces:
TokenTypes

public class ParseTreeWalker
extends java.lang.Object
implements TokenTypes

A class which walks the parse tree created by the parser to check for errors and translate to SQL.
Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:08:25 $
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

Fields inherited from interface org.exolab.castor.jdo.oql.TokenTypes

ARROW, BOOLEAN_LITERAL, CHAR_LITERAL, COLON, COMMA, CONCAT, DATE_LITERAL, DIVIDE, DOLLAR, DOT, DOUBLE_LITERAL, END_OF_QUERY, EQUAL, GT, GTE, IDENTIFIER, KEYWORD_ABS, KEYWORD_AND, KEYWORD_AS, KEYWORD_ASC, KEYWORD_AVG, KEYWORD_BETWEEN, KEYWORD_BY, KEYWORD_COUNT, KEYWORD_DESC, KEYWORD_DISTINCT, KEYWORD_FROM, KEYWORD_IN, KEYWORD_IS_DEFINED, KEYWORD_IS_UNDEFINED, KEYWORD_LIKE, KEYWORD_LIMIT, KEYWORD_LIST, KEYWORD_MAX, KEYWORD_MIN, KEYWORD_MOD, KEYWORD_NIL, KEYWORD_NOT, KEYWORD_OR, KEYWORD_ORDER, KEYWORD_SELECT, KEYWORD_SUM, KEYWORD_UNDEFINED, KEYWORD_WHERE, LONG_LITERAL, LPAREN, LT, LTE, MINUS, NOT_EQUAL, PLUS, RPAREN, STRING_LITERAL, TIMES, TIMESTAMP_LITERAL, TIME_LITERAL

Constructor Summary

ParseTreeWalker(LockEngine dbEngine, ParseTreeNode parseTree, ClassLoader classLoader)
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
getPathInfo()
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)
            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
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

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.

getPathInfo

public Vector getPathInfo()
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.

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-2003. All rights reserved http://www.intalio.com