|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.query.parser.QueryParser
public class QueryParser
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.
In the future this class may hide a single- or multi-thread cache of parsed queries.
Constructor Summary | |
---|---|
QueryParser()
Construct a QueryParser - this may be reused. |
Method Summary | |
---|---|
static int |
getCommandType(java.lang.String sql)
Takes a SQL string and determines the command type, as defined in the constants of Command . |
static QueryParser |
getQueryParser()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryParser()
Method Detail |
---|
public static QueryParser getQueryParser()
public Command parseCommand(java.lang.String sql) throws QueryParserException
sql
- SQL string
instead of string litral
QueryParserException
- if parsing fails
java.lang.IllegalArgumentException
- if sql is nullpublic Command parseCommand(java.lang.String sql, ParseInfo parseInfo) throws QueryParserException
sql
- SQL stringparseInfo
- - instructions to parse
QueryParserException
- if parsing fails
java.lang.IllegalArgumentException
- if sql is nullpublic Criteria parseCriteria(java.lang.String sql) throws QueryParserException
sql
- SQL criteria (WHERE clause) string
QueryParserException
- if parsing fails
java.lang.IllegalArgumentException
- if sql is nullpublic Expression parseExpression(java.lang.String sql) throws QueryParserException
sql
- SQL expression string
QueryParserException
- if parsing fails
java.lang.IllegalArgumentException
- if sql is nullpublic static int getCommandType(java.lang.String sql)
Command
.
sql
- SQL string
Command
.
Note: not all XQuery queries will necessarily be detected - if type UNKNOWN is indicated
it's possible it is an XQuery.
java.lang.IllegalArgumentException
- if sql is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |