public class QueryParser extends Object implements Parser
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 and Description |
|---|
QueryParser()
Construct a QueryParser - this may be reused.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add_escapes(String str,
StringBuilder retval)
Used to convert raw characters to their escaped version
when these raw version cannot be used as part of an ASCII
string literal.
|
String |
getMessage(ParseException pe,
int maxExpansions)
The default JavaCC message is not very good.
|
static QueryParser |
getQueryParser() |
CacheHint |
parseCacheHint(String sql) |
Command |
parseCommand(String sql)
Takes a SQL string representing a Command and returns the object
representation.
|
Command |
parseCommand(String sql,
ParseInfo parseInfo)
Takes a SQL string representing a Command and returns the object
representation.
|
Criteria |
parseCriteria(String sql)
Takes a SQL string representing an SQL criteria (i.e.
|
void |
parseDDL(DatabaseStore repository,
Reader ddl) |
void |
parseDDL(MetadataFactory factory,
Reader ddl)
Parses the given
Reader into the MetadataFactory. |
void |
parseDDL(MetadataFactory factory,
String ddl) |
Expression |
parseExpression(String sql)
Takes a SQL string representing an SQL expression
and returns the object representation.
|
Command |
parseProcedure(String sql,
boolean update) |
Expression |
parseSelectExpression(String sql) |
public static QueryParser getQueryParser()
public Command parseCommand(String sql) throws QueryParserException
sql - SQL string
instead of string litralQueryParserException - if parsing failsIllegalArgumentException - if sql is nullpublic Command parseProcedure(String sql, boolean update) throws QueryParserException
QueryParserExceptionpublic Command parseCommand(String sql, ParseInfo parseInfo) throws QueryParserException
sql - SQL stringparseInfo - - instructions to parseQueryParserException - if parsing failsIllegalArgumentException - if sql is nullpublic Criteria parseCriteria(String sql) throws QueryParserException
sql - SQL criteria (WHERE clause) stringQueryParserException - if parsing failsIllegalArgumentException - if sql is nullpublic String getMessage(ParseException pe, int maxExpansions)
pe - maxExpansions - protected void add_escapes(String str, StringBuilder retval)
public Expression parseExpression(String sql) throws QueryParserException
sql - SQL expression stringQueryParserException - if parsing failsIllegalArgumentException - if sql is nullpublic Expression parseSelectExpression(String sql) throws QueryParserException
QueryParserExceptionpublic void parseDDL(MetadataFactory factory, String ddl)
public void parseDDL(MetadataFactory factory, Reader ddl)
Parserpublic void parseDDL(DatabaseStore repository, Reader ddl) throws MetadataException
MetadataExceptionCopyright © 2020. All rights reserved.