org.teiid.query.parser
Class QueryParser

java.lang.Object
  extended by org.teiid.query.parser.QueryParser

public class QueryParser
extends java.lang.Object

Converts a SQL-string to an object version of a query. This QueryParser can be reused but is NOT thread-safe as the parser uses an input stream. Putting multiple queries into the same stream will result in unpredictable and most likely incorrect behavior.


Constructor Summary
QueryParser()
          Construct a QueryParser - this may be reused.
 
Method Summary
static QueryParser getQueryParser()
           
 CacheHint parseCacheHint(java.lang.String sql)
           
 Command parseCommand(java.lang.String sql)
          Takes a SQL string representing a Command and returns the object representation.
 Command parseCommand(java.lang.String sql, ParseInfo parseInfo)
          Takes a SQL string representing a Command and returns the object representation.
 Criteria parseCriteria(java.lang.String sql)
          Takes a SQL string representing an SQL criteria (i.e.
 Expression parseExpression(java.lang.String sql)
          Takes a SQL string representing an SQL expression and returns the object representation.
 Command parseUpdateProcedure(java.lang.String sql)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryParser

public QueryParser()
Construct a QueryParser - this may be reused.

Method Detail

getQueryParser

public static QueryParser getQueryParser()

parseCommand

public Command parseCommand(java.lang.String sql)
                     throws QueryParserException
Takes a SQL string representing a Command and returns the object representation.

Parameters:
sql - SQL string instead of string litral
Returns:
SQL object representation
Throws:
QueryParserException - if parsing fails
java.lang.IllegalArgumentException - if sql is null

parseUpdateProcedure

public Command parseUpdateProcedure(java.lang.String sql)
                             throws QueryParserException
Throws:
QueryParserException

parseCommand

public Command parseCommand(java.lang.String sql,
                            ParseInfo parseInfo)
                     throws QueryParserException
Takes a SQL string representing a Command and returns the object representation.

Parameters:
sql - SQL string
parseInfo - - instructions to parse
Returns:
SQL object representation
Throws:
QueryParserException - if parsing fails
java.lang.IllegalArgumentException - if sql is null

parseCacheHint

public CacheHint parseCacheHint(java.lang.String sql)
                         throws QueryParserException
Throws:
QueryParserException

parseCriteria

public Criteria parseCriteria(java.lang.String sql)
                       throws QueryParserException
Takes a SQL string representing an SQL criteria (i.e. just the WHERE clause) and returns the object representation.

Parameters:
sql - SQL criteria (WHERE clause) string
Returns:
Criteria SQL object representation
Throws:
QueryParserException - if parsing fails
java.lang.IllegalArgumentException - if sql is null

parseExpression

public Expression parseExpression(java.lang.String sql)
                           throws QueryParserException
Takes a SQL string representing an SQL expression and returns the object representation.

Parameters:
sql - SQL expression string
Returns:
SQL expression object
Throws:
QueryParserException - if parsing fails
java.lang.IllegalArgumentException - if sql is null


Copyright © 2011. All Rights Reserved.