public class SqlParser extends Object
SqlParser parses a SQL statement.| Modifier and Type | Class and Description |
|---|---|
static interface |
SqlParser.Config
Interface to define the configuration for a SQL parser.
|
static class |
SqlParser.ConfigBuilder
Builder for a
SqlParser.Config. |
private static class |
SqlParser.ConfigImpl
Implementation of
SqlParser.Config. |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_ALLOW_BANG_EQUAL
Deprecated.
|
static int |
DEFAULT_IDENTIFIER_MAX_LENGTH |
private String |
originalInput |
private SqlAbstractParserImpl |
parser |
| Modifier | Constructor and Description |
|---|---|
private |
SqlParser(String s,
SqlAbstractParserImpl parser,
SqlParser.Config config) |
| Modifier and Type | Method and Description |
|---|---|
static SqlParser.ConfigBuilder |
configBuilder()
Builder for a
SqlParser.Config. |
static SqlParser.ConfigBuilder |
configBuilder(SqlParser.Config config)
Builder for a
SqlParser.Config that starts with an existing Config. |
static SqlParser |
create(String s)
Creates a
SqlParser to parse the given string using
Calcite's parser implementation. |
static SqlParser |
create(String sql,
SqlParser.Config config)
Creates a
SqlParser to parse the given string using the
parser implementation created from given SqlParserImplFactory
with given quoting syntax and casing policies for identifiers. |
SqlAbstractParserImpl.Metadata |
getMetadata()
Get the parser metadata.
|
SqlNode |
parseExpression()
Parses a SQL expression.
|
SqlNode |
parseQuery()
Parses a
SELECT statement. |
SqlNode |
parseQuery(String sql)
Parses a
SELECT statement and reuses parser. |
SqlNode |
parseStmt()
Parses an SQL statement.
|
public static final int DEFAULT_IDENTIFIER_MAX_LENGTH
@Deprecated public static final boolean DEFAULT_ALLOW_BANG_EQUAL
private final SqlAbstractParserImpl parser
private final String originalInput
private SqlParser(String s, SqlAbstractParserImpl parser, SqlParser.Config config)
public static SqlParser create(String s)
SqlParser to parse the given string using
Calcite's parser implementation.
The default lexical policy is similar to Oracle.
s - An SQL statement or expression to parse.Lex.ORACLEpublic static SqlParser create(String sql, SqlParser.Config config)
SqlParser to parse the given string using the
parser implementation created from given SqlParserImplFactory
with given quoting syntax and casing policies for identifiers.sql - A SQL statement or expression to parse.config - The parser configuration (identifier max length, etc.)public SqlNode parseExpression() throws SqlParseException
SqlParseException - if there is a parse errorpublic SqlNode parseQuery() throws SqlParseException
SELECT statement.SqlSelect for a regular
SELECT statement; a SqlBinaryOperator
for a UNION, INTERSECT, or EXCEPT.SqlParseException - if there is a parse errorpublic SqlNode parseQuery(String sql) throws SqlParseException
SELECT statement and reuses parser.sql - sql to parseSqlSelect for a regular
SELECT statement; a SqlBinaryOperator
for a UNION, INTERSECT, or EXCEPT.SqlParseException - if there is a parse errorpublic SqlNode parseStmt() throws SqlParseException
SqlParseException - if there is a parse errorpublic SqlAbstractParserImpl.Metadata getMetadata()
SqlAbstractParserImpl.Metadata implementation of
underlying parser.public static SqlParser.ConfigBuilder configBuilder()
SqlParser.Config.public static SqlParser.ConfigBuilder configBuilder(SqlParser.Config config)
SqlParser.Config that starts with an existing Config.Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.