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. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_IDENTIFIER_MAX_LENGTH |
| 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 |
parseStmt()
Parses an SQL statement.
|
public static final int DEFAULT_IDENTIFIER_MAX_LENGTH
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 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–2015 The Apache Software Foundation. All rights reserved.