com.caucho.amber.query
Class QueryParser

java.lang.Object
  extended by com.caucho.amber.query.QueryParser

public class QueryParser
extends java.lang.Object

Contains the parser for EJB 3.0 style queries and stores the parsed expressions.


Field Summary
static int ABS
           
static int AND
           
static int ARG
           
static int AS
           
static int ASC
           
static int BETWEEN
           
static int BOTH
           
static int BY
           
static int CONCAT
           
static int CONCAT_OP
           
static int CURRENT_DATE
           
static int CURRENT_TIME
           
static int CURRENT_TIMESTAMP
           
static int DELETE
           
static int DESC
           
static int DISTINCT
           
static int DOUBLE
           
static int EMPTY
           
static int EQ
           
static int ESCAPE
           
static int EXTERNAL_DOT
           
static int FALSE
           
static int FETCH
           
static int FROM
           
static int GE
           
static int GROUP
           
static int GT
           
static int HAVING
           
static int IDENTIFIER
           
static int IN
           
static int INNER
           
static int INTEGER
           
static int IS
           
static int JOIN
           
static int LE
           
static int LEADING
           
static int LEFT
           
static int LENGTH
           
static int LIKE
           
static int LIMIT
           
static int LOCATE
           
static int LONG
           
static int LOWER
           
static int LT
           
static int MAX
           
static int MEMBER
           
static int MIN
           
static int MOD
           
static int NAMED_ARG
           
static int NE
           
static int NEW
           
static int NOT
           
static int NOT_NULL
           
static int NULL
           
static int OF
           
static int OFFSET
           
static int OR
           
static int ORDER
           
static int OUTER
           
static int SELECT
           
static int SET
           
static int SIZE
           
static int SQRT
           
static int STRING
           
static int SUBSTRING
           
static int SUM
           
static int THIS
           
static int TRAILING
           
static int TRIM
           
static int TRUE
           
static int UNKNOWN
           
static int UPDATE
           
static int UPPER
           
static int WHERE
           
 
Constructor Summary
QueryParser(java.lang.String query)
          Creates the query parser.
 
Method Summary
 void addArg(ArgExpr arg)
          Adds a new argument
 FromItem addFromItem(AmberTable table)
          Adds a new FromItem.
 FromItem addFromItem(AmberTable table, java.lang.String id)
          Adds a new FromItem.
 FromItem addFromItem(EntityType entityType, AmberTable table)
          Adds a new FromItem.
 FromItem addFromItem(EntityType entityType, AmberTable table, java.lang.String id)
          Adds a new FromItem.
 PathExpr addPath(PathExpr path)
          Adds an entity path
 FromItem createDependentFromItem(FromItem item, LinkColumns link)
          Adds a new FromItem.
 java.lang.String createTableName()
          Returns a unique table name
 QueryParseException error(java.lang.String msg)
          Creates an error.
 int generateSQLArg()
          Generates a new arg.
 java.lang.String getQuery()
          Returns the query string
 AbstractQuery getSelectQuery()
          Returns the query string
 boolean isDerbyDBMS()
          Returns true for Derby-like DBMS.
 boolean isPostgresDBMS()
          Returns true for Postgres-like DBMS.
 AbstractQuery parse()
          Parses the query.
 void setLazyResult(boolean isLazy)
          Sets true for lazy loading.
 void setPersistenceUnit(AmberPersistenceUnit persistenceUnit)
          Sets the persistence unit.
 java.lang.String toString()
          Returns a debuggable description of the select.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IDENTIFIER

public static final int IDENTIFIER
See Also:
Constant Field Values

INTEGER

public static final int INTEGER
See Also:
Constant Field Values

LONG

public static final int LONG
See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
See Also:
Constant Field Values

STRING

public static final int STRING
See Also:
Constant Field Values

TRUE

public static final int TRUE
See Also:
Constant Field Values

FALSE

public static final int FALSE
See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

MEMBER

public static final int MEMBER
See Also:
Constant Field Values

OF

public static final int OF
See Also:
Constant Field Values

EMPTY

public static final int EMPTY
See Also:
Constant Field Values

NULL

public static final int NULL
See Also:
Constant Field Values

FROM

public static final int FROM
See Also:
Constant Field Values

IN

public static final int IN
See Also:
Constant Field Values

SELECT

public static final int SELECT
See Also:
Constant Field Values

UPDATE

public static final int UPDATE
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values

DISTINCT

public static final int DISTINCT
See Also:
Constant Field Values

WHERE

public static final int WHERE
See Also:
Constant Field Values

AS

public static final int AS
See Also:
Constant Field Values

SET

public static final int SET
See Also:
Constant Field Values

ORDER

public static final int ORDER
See Also:
Constant Field Values

GROUP

public static final int GROUP
See Also:
Constant Field Values

BY

public static final int BY
See Also:
Constant Field Values

ASC

public static final int ASC
See Also:
Constant Field Values

DESC

public static final int DESC
See Also:
Constant Field Values

LIMIT

public static final int LIMIT
See Also:
Constant Field Values

OFFSET

public static final int OFFSET
See Also:
Constant Field Values

JOIN

public static final int JOIN
See Also:
Constant Field Values

INNER

public static final int INNER
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

OUTER

public static final int OUTER
See Also:
Constant Field Values

FETCH

public static final int FETCH
See Also:
Constant Field Values

BETWEEN

public static final int BETWEEN
See Also:
Constant Field Values

LIKE

public static final int LIKE
See Also:
Constant Field Values

ESCAPE

public static final int ESCAPE
See Also:
Constant Field Values

IS

public static final int IS
See Also:
Constant Field Values

CONCAT_OP

public static final int CONCAT_OP
See Also:
Constant Field Values

EQ

public static final int EQ
See Also:
Constant Field Values

NE

public static final int NE
See Also:
Constant Field Values

LT

public static final int LT
See Also:
Constant Field Values

LE

public static final int LE
See Also:
Constant Field Values

GT

public static final int GT
See Also:
Constant Field Values

GE

public static final int GE
See Also:
Constant Field Values

AND

public static final int AND
See Also:
Constant Field Values

OR

public static final int OR
See Also:
Constant Field Values

NOT

public static final int NOT
See Also:
Constant Field Values

LENGTH

public static final int LENGTH
See Also:
Constant Field Values

LOCATE

public static final int LOCATE
See Also:
Constant Field Values

ABS

public static final int ABS
See Also:
Constant Field Values

SQRT

public static final int SQRT
See Also:
Constant Field Values

MOD

public static final int MOD
See Also:
Constant Field Values

SIZE

public static final int SIZE
See Also:
Constant Field Values

MAX

public static final int MAX
See Also:
Constant Field Values

MIN

public static final int MIN
See Also:
Constant Field Values

SUM

public static final int SUM
See Also:
Constant Field Values

CONCAT

public static final int CONCAT
See Also:
Constant Field Values

LOWER

public static final int LOWER
See Also:
Constant Field Values

UPPER

public static final int UPPER
See Also:
Constant Field Values

SUBSTRING

public static final int SUBSTRING
See Also:
Constant Field Values

TRIM

public static final int TRIM
See Also:
Constant Field Values

BOTH

public static final int BOTH
See Also:
Constant Field Values

LEADING

public static final int LEADING
See Also:
Constant Field Values

TRAILING

public static final int TRAILING
See Also:
Constant Field Values

CURRENT_DATE

public static final int CURRENT_DATE
See Also:
Constant Field Values

CURRENT_TIME

public static final int CURRENT_TIME
See Also:
Constant Field Values

CURRENT_TIMESTAMP

public static final int CURRENT_TIMESTAMP
See Also:
Constant Field Values

EXTERNAL_DOT

public static final int EXTERNAL_DOT
See Also:
Constant Field Values

ARG

public static final int ARG
See Also:
Constant Field Values

NAMED_ARG

public static final int NAMED_ARG
See Also:
Constant Field Values

NEW

public static final int NEW
See Also:
Constant Field Values

THIS

public static final int THIS
See Also:
Constant Field Values

NOT_NULL

public static final int NOT_NULL
See Also:
Constant Field Values

HAVING

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

QueryParser

public QueryParser(java.lang.String query)
Creates the query parser.

Method Detail

isDerbyDBMS

public boolean isDerbyDBMS()
Returns true for Derby-like DBMS.


isPostgresDBMS

public boolean isPostgresDBMS()
Returns true for Postgres-like DBMS.


setPersistenceUnit

public void setPersistenceUnit(AmberPersistenceUnit persistenceUnit)
Sets the persistence unit.


setLazyResult

public void setLazyResult(boolean isLazy)
Sets true for lazy loading.


getQuery

public java.lang.String getQuery()
Returns the query string


getSelectQuery

public AbstractQuery getSelectQuery()
Returns the query string


generateSQLArg

public int generateSQLArg()
Generates a new arg.


parse

public AbstractQuery parse()
                    throws AmberException
Parses the query.

Throws:
AmberException

addFromItem

public FromItem addFromItem(AmberTable table)
Adds a new FromItem.


addFromItem

public FromItem addFromItem(EntityType entityType,
                            AmberTable table)
Adds a new FromItem.


createTableName

public java.lang.String createTableName()
Returns a unique table name


addFromItem

public FromItem addFromItem(AmberTable table,
                            java.lang.String id)
Adds a new FromItem.


addFromItem

public FromItem addFromItem(EntityType entityType,
                            AmberTable table,
                            java.lang.String id)
Adds a new FromItem.


createDependentFromItem

public FromItem createDependentFromItem(FromItem item,
                                        LinkColumns link)
Adds a new FromItem.


addPath

public PathExpr addPath(PathExpr path)
Adds an entity path


addArg

public void addArg(ArgExpr arg)
Adds a new argument


error

public QueryParseException error(java.lang.String msg)
Creates an error.


toString

public java.lang.String toString()
Returns a debuggable description of the select.

Overrides:
toString in class java.lang.Object