mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
Fix cargo docs / warnings
and add CI check (#777)
* Fix all rustdoc links
* Add docs CI check
* workflow
* test error
* fix yml
* fix yml
* Revert "test error"
This reverts commit 96a40a88a3
.
* fix
* more
This commit is contained in:
parent
072ccc0d76
commit
b93d82dfca
8 changed files with 79 additions and 26 deletions
10
.github/workflows/rust.yml
vendored
10
.github/workflows/rust.yml
vendored
|
@ -35,6 +35,16 @@ jobs:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- run: cargo check --all-targets --all-features
|
- run: cargo check --all-targets --all-features
|
||||||
|
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUSTDOCFLAGS: "-Dwarnings"
|
||||||
|
steps:
|
||||||
|
- name: Set up Rust
|
||||||
|
uses: hecrj/setup-rust-action@v1
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- run: cargo doc --document-private-items --no-deps --workspace --all-features
|
||||||
|
|
||||||
compile-no-std:
|
compile-no-std:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! AST types specific to CREATE/ALTER variants of [Statement]
|
//! AST types specific to CREATE/ALTER variants of [`Statement`](crate::ast::Statement)
|
||||||
//! (commonly referred to as Data Definition Language, or DDL)
|
//! (commonly referred to as Data Definition Language, or DDL)
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
|
@ -325,6 +325,7 @@ pub enum TableConstraint {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [1]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html
|
/// [1]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html
|
||||||
|
/// [2]: https://dev.mysql.com/doc/refman/8.0/en/spatial-types.html
|
||||||
FulltextOrSpatial {
|
FulltextOrSpatial {
|
||||||
/// Whether this is a `FULLTEXT` (true) or `SPATIAL` (false) definition.
|
/// Whether this is a `FULLTEXT` (true) or `SPATIAL` (false) definition.
|
||||||
fulltext: bool,
|
fulltext: bool,
|
||||||
|
|
|
@ -372,39 +372,52 @@ pub enum Expr {
|
||||||
timestamp: Box<Expr>,
|
timestamp: Box<Expr>,
|
||||||
time_zone: String,
|
time_zone: String,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// EXTRACT(DateTimeField FROM <expr>)
|
/// EXTRACT(DateTimeField FROM <expr>)
|
||||||
|
/// ```
|
||||||
Extract {
|
Extract {
|
||||||
field: DateTimeField,
|
field: DateTimeField,
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CEIL(<expr> [TO DateTimeField])
|
/// CEIL(<expr> [TO DateTimeField])
|
||||||
|
/// ```
|
||||||
Ceil {
|
Ceil {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
field: DateTimeField,
|
field: DateTimeField,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// FLOOR(<expr> [TO DateTimeField])
|
/// FLOOR(<expr> [TO DateTimeField])
|
||||||
|
/// ```
|
||||||
Floor {
|
Floor {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
field: DateTimeField,
|
field: DateTimeField,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// POSITION(<expr> in <expr>)
|
/// POSITION(<expr> in <expr>)
|
||||||
|
/// ```
|
||||||
Position { expr: Box<Expr>, r#in: Box<Expr> },
|
Position { expr: Box<Expr>, r#in: Box<Expr> },
|
||||||
|
/// ```sql
|
||||||
/// SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])
|
/// SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])
|
||||||
|
/// ```
|
||||||
Substring {
|
Substring {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
substring_from: Option<Box<Expr>>,
|
substring_from: Option<Box<Expr>>,
|
||||||
substring_for: Option<Box<Expr>>,
|
substring_for: Option<Box<Expr>>,
|
||||||
},
|
},
|
||||||
/// TRIM([BOTH | LEADING | TRAILING] [<expr> FROM] <expr>)\
|
/// ```sql
|
||||||
/// Or\
|
/// TRIM([BOTH | LEADING | TRAILING] [<expr> FROM] <expr>)
|
||||||
/// TRIM(<expr>)
|
/// TRIM(<expr>)
|
||||||
|
/// ```
|
||||||
Trim {
|
Trim {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
// ([BOTH | LEADING | TRAILING]
|
// ([BOTH | LEADING | TRAILING]
|
||||||
trim_where: Option<TrimWhereField>,
|
trim_where: Option<TrimWhereField>,
|
||||||
trim_what: Option<Box<Expr>>,
|
trim_what: Option<Box<Expr>>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// OVERLAY(<expr> PLACING <expr> FROM <expr>[ FOR <expr> ]
|
/// OVERLAY(<expr> PLACING <expr> FROM <expr>[ FOR <expr> ]
|
||||||
|
/// ```
|
||||||
Overlay {
|
Overlay {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
overlay_what: Box<Expr>,
|
overlay_what: Box<Expr>,
|
||||||
|
@ -426,7 +439,7 @@ pub enum Expr {
|
||||||
TypedString { data_type: DataType, value: String },
|
TypedString { data_type: DataType, value: String },
|
||||||
/// Access a map-like object by field (e.g. `column['field']` or `column[4]`
|
/// Access a map-like object by field (e.g. `column['field']` or `column[4]`
|
||||||
/// Note that depending on the dialect, struct like accesses may be
|
/// Note that depending on the dialect, struct like accesses may be
|
||||||
/// parsed as [`ArrayIndex`] or [`MapAccess`]
|
/// parsed as [`ArrayIndex`](Self::ArrayIndex) or [`MapAccess`](Self::MapAccess)
|
||||||
/// <https://clickhouse.com/docs/en/sql-reference/data-types/map/>
|
/// <https://clickhouse.com/docs/en/sql-reference/data-types/map/>
|
||||||
MapAccess { column: Box<Expr>, keys: Vec<Expr> },
|
MapAccess { column: Box<Expr>, keys: Vec<Expr> },
|
||||||
/// Scalar function call e.g. `LEFT(foo, 5)`
|
/// Scalar function call e.g. `LEFT(foo, 5)`
|
||||||
|
@ -490,7 +503,7 @@ pub enum Expr {
|
||||||
/// `MySQL` specific text search function [(1)].
|
/// `MySQL` specific text search function [(1)].
|
||||||
///
|
///
|
||||||
/// Syntax:
|
/// Syntax:
|
||||||
/// ```text
|
/// ```sql
|
||||||
/// MARCH (<col>, <col>, ...) AGAINST (<expr> [<search modifier>])
|
/// MARCH (<col>, <col>, ...) AGAINST (<expr> [<search modifier>])
|
||||||
///
|
///
|
||||||
/// <col> = CompoundIdentifier
|
/// <col> = CompoundIdentifier
|
||||||
|
@ -956,9 +969,9 @@ pub struct WindowFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for WindowFrame {
|
impl Default for WindowFrame {
|
||||||
/// returns default value for window frame
|
/// Returns default value for window frame
|
||||||
///
|
///
|
||||||
/// see https://www.sqlite.org/windowfunctions.html#frame_specifications
|
/// See [this page](https://www.sqlite.org/windowfunctions.html#frame_specifications) for more details.
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
units: WindowFrameUnits::Range,
|
units: WindowFrameUnits::Range,
|
||||||
|
@ -1365,7 +1378,9 @@ pub enum Statement {
|
||||||
/// Role name. If NONE is specified, then the current role name is removed.
|
/// Role name. If NONE is specified, then the current role name is removed.
|
||||||
role_name: Option<Ident>,
|
role_name: Option<Ident>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SET <variable>
|
/// SET <variable>
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is not a standard SQL statement, but it is supported by at
|
/// Note: this is not a standard SQL statement, but it is supported by at
|
||||||
/// least MySQL and PostgreSQL. Not all MySQL-specific syntatic forms are
|
/// least MySQL and PostgreSQL. Not all MySQL-specific syntatic forms are
|
||||||
|
@ -1376,10 +1391,12 @@ pub enum Statement {
|
||||||
variable: ObjectName,
|
variable: ObjectName,
|
||||||
value: Vec<Expr>,
|
value: Vec<Expr>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SET TIME ZONE <value>
|
/// SET TIME ZONE <value>
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statements
|
/// Note: this is a PostgreSQL-specific statements
|
||||||
/// SET TIME ZONE <value> is an alias for SET timezone TO <value> in PostgreSQL
|
/// `SET TIME ZONE <value>` is an alias for `SET timezone TO <value>` in PostgreSQL
|
||||||
SetTimeZone { local: bool, value: Expr },
|
SetTimeZone { local: bool, value: Expr },
|
||||||
/// SET NAMES 'charset_name' [COLLATE 'collation_name']
|
/// SET NAMES 'charset_name' [COLLATE 'collation_name']
|
||||||
///
|
///
|
||||||
|
@ -1396,7 +1413,9 @@ pub enum Statement {
|
||||||
///
|
///
|
||||||
/// Note: this is a Presto-specific statement.
|
/// Note: this is a Presto-specific statement.
|
||||||
ShowFunctions { filter: Option<ShowStatementFilter> },
|
ShowFunctions { filter: Option<ShowStatementFilter> },
|
||||||
|
/// ```sql
|
||||||
/// SHOW <variable>
|
/// SHOW <variable>
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement.
|
/// Note: this is a PostgreSQL-specific statement.
|
||||||
ShowVariable { variable: Vec<Ident> },
|
ShowVariable { variable: Vec<Ident> },
|
||||||
|
@ -1471,10 +1490,13 @@ pub enum Statement {
|
||||||
location: Option<String>,
|
location: Option<String>,
|
||||||
managed_location: Option<String>,
|
managed_location: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CREATE FUNCTION
|
/// CREATE FUNCTION
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Hive: https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction
|
/// Supported variants:
|
||||||
/// Postgres: https://www.postgresql.org/docs/15/sql-createfunction.html
|
/// 1. [Hive](https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction)
|
||||||
|
/// 2. [Postgres](https://www.postgresql.org/docs/15/sql-createfunction.html)
|
||||||
CreateFunction {
|
CreateFunction {
|
||||||
or_replace: bool,
|
or_replace: bool,
|
||||||
temporary: bool,
|
temporary: bool,
|
||||||
|
@ -1567,8 +1589,11 @@ pub enum Statement {
|
||||||
// Specifies the actions to perform when values match or do not match.
|
// Specifies the actions to perform when values match or do not match.
|
||||||
clauses: Vec<MergeClause>,
|
clauses: Vec<MergeClause>,
|
||||||
},
|
},
|
||||||
/// CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]
|
/// `CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]`.
|
||||||
/// Based on Spark SQL,see <https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-aux-cache-cache-table.html>
|
///
|
||||||
|
/// See [Spark SQL docs] for more details.
|
||||||
|
///
|
||||||
|
/// [Spark SQL docs]: https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-aux-cache-cache-table.html
|
||||||
Cache {
|
Cache {
|
||||||
/// Table flag
|
/// Table flag
|
||||||
table_flag: Option<ObjectName>,
|
table_flag: Option<ObjectName>,
|
||||||
|
@ -2707,9 +2732,11 @@ impl fmt::Display for Statement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Can use to describe options in create sequence or table column type identity
|
/// Can use to describe options in create sequence or table column type identity
|
||||||
|
/// ```sql
|
||||||
/// [ INCREMENT [ BY ] increment ]
|
/// [ INCREMENT [ BY ] increment ]
|
||||||
/// [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
|
/// [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
|
||||||
/// [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
|
/// [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
|
||||||
|
/// ```
|
||||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "visitor", derive(Visit))]
|
#[cfg_attr(feature = "visitor", derive(Visit))]
|
||||||
|
@ -3540,7 +3567,8 @@ impl fmt::Display for ShowStatementFilter {
|
||||||
|
|
||||||
/// Sqlite specific syntax
|
/// Sqlite specific syntax
|
||||||
///
|
///
|
||||||
/// https://sqlite.org/lang_conflict.html
|
/// See [Sqlite documentation](https://sqlite.org/lang_conflict.html)
|
||||||
|
/// for more details.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "visitor", derive(Visit))]
|
#[cfg_attr(feature = "visitor", derive(Visit))]
|
||||||
|
@ -3979,7 +4007,10 @@ impl fmt::Display for FunctionDefinition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Postgres: https://www.postgresql.org/docs/15/sql-createfunction.html
|
/// Postgres specific feature.
|
||||||
|
///
|
||||||
|
/// See [Postgresdocs](https://www.postgresql.org/docs/15/sql-createfunction.html)
|
||||||
|
/// for more details
|
||||||
#[derive(Debug, Default, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
#[derive(Debug, Default, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "visitor", derive(Visit))]
|
#[cfg_attr(feature = "visitor", derive(Visit))]
|
||||||
|
|
|
@ -529,6 +529,7 @@ pub enum TableFactor {
|
||||||
expr: Expr,
|
expr: Expr,
|
||||||
alias: Option<TableAlias>,
|
alias: Option<TableAlias>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SELECT * FROM UNNEST ([10,20,30]) as numbers WITH OFFSET;
|
/// SELECT * FROM UNNEST ([10,20,30]) as numbers WITH OFFSET;
|
||||||
/// +---------+--------+
|
/// +---------+--------+
|
||||||
/// | numbers | offset |
|
/// | numbers | offset |
|
||||||
|
@ -537,6 +538,7 @@ pub enum TableFactor {
|
||||||
/// | 20 | 1 |
|
/// | 20 | 1 |
|
||||||
/// | 30 | 2 |
|
/// | 30 | 2 |
|
||||||
/// +---------+--------+
|
/// +---------+--------+
|
||||||
|
/// ```
|
||||||
UNNEST {
|
UNNEST {
|
||||||
alias: Option<TableAlias>,
|
alias: Option<TableAlias>,
|
||||||
array_expr: Box<Expr>,
|
array_expr: Box<Expr>,
|
||||||
|
|
|
@ -38,7 +38,8 @@ pub enum Value {
|
||||||
// $<tag_name>$string value$<tag_name>$ (postgres syntax)
|
// $<tag_name>$string value$<tag_name>$ (postgres syntax)
|
||||||
DollarQuotedString(DollarQuotedString),
|
DollarQuotedString(DollarQuotedString),
|
||||||
/// e'string value' (postgres extension)
|
/// e'string value' (postgres extension)
|
||||||
/// <https://www.postgresql.org/docs/8.3/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS
|
/// See [Postgres docs](https://www.postgresql.org/docs/8.3/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS)
|
||||||
|
/// for more details.
|
||||||
EscapedStringLiteral(String),
|
EscapedStringLiteral(String),
|
||||||
/// N'string value'
|
/// N'string value'
|
||||||
NationalStringLiteral(String),
|
NationalStringLiteral(String),
|
||||||
|
|
|
@ -71,9 +71,10 @@ pub trait Dialect: Debug + Any {
|
||||||
fn supports_filter_during_aggregation(&self) -> bool {
|
fn supports_filter_during_aggregation(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
/// Returns true if the dialect supports ARRAY_AGG() [WITHIN GROUP (ORDER BY)] expressions.
|
/// Returns true if the dialect supports `ARRAY_AGG() [WITHIN GROUP (ORDER BY)]` expressions.
|
||||||
/// Otherwise, the dialect should expect an `ORDER BY` without the `WITHIN GROUP` clause, e.g. `ANSI` [(1)].
|
/// Otherwise, the dialect should expect an `ORDER BY` without the `WITHIN GROUP` clause, e.g. [`ANSI`]
|
||||||
/// [(1)]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#array-aggregate-function
|
///
|
||||||
|
/// [`ANSI`]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#array-aggregate-function
|
||||||
fn supports_within_after_array_aggregation(&self) -> bool {
|
fn supports_within_after_array_aggregation(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! This module defines
|
//! This module defines
|
||||||
//! 1) a list of constants for every keyword that
|
//! 1) a list of constants for every keyword
|
||||||
//! can appear in [Word::keyword]:
|
|
||||||
//! pub const KEYWORD = "KEYWORD"
|
|
||||||
//! 2) an `ALL_KEYWORDS` array with every keyword in it
|
//! 2) an `ALL_KEYWORDS` array with every keyword in it
|
||||||
//! This is not a list of *reserved* keywords: some of these can be
|
//! This is not a list of *reserved* keywords: some of these can be
|
||||||
//! parsed as identifiers if the parser decides so. This means that
|
//! parsed as identifiers if the parser decides so. This means that
|
||||||
|
|
|
@ -1181,8 +1181,10 @@ impl<'a> Parser<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TRIM ([WHERE] ['text' FROM] 'text')\
|
/// ```sql
|
||||||
|
/// TRIM ([WHERE] ['text' FROM] 'text')
|
||||||
/// TRIM ('text')
|
/// TRIM ('text')
|
||||||
|
/// ```
|
||||||
pub fn parse_trim_expr(&mut self) -> Result<Expr, ParserError> {
|
pub fn parse_trim_expr(&mut self) -> Result<Expr, ParserError> {
|
||||||
self.expect_token(&Token::LParen)?;
|
self.expect_token(&Token::LParen)?;
|
||||||
let mut trim_where = None;
|
let mut trim_where = None;
|
||||||
|
@ -2984,8 +2986,10 @@ impl<'a> Parser<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ```sql
|
||||||
/// DROP FUNCTION [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
|
/// DROP FUNCTION [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
|
||||||
/// [ CASCADE | RESTRICT ]
|
/// [ CASCADE | RESTRICT ]
|
||||||
|
/// ```
|
||||||
fn parse_drop_function(&mut self) -> Result<Statement, ParserError> {
|
fn parse_drop_function(&mut self) -> Result<Statement, ParserError> {
|
||||||
let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
|
let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
|
||||||
let func_desc = self.parse_comma_separated(Parser::parse_drop_function_desc)?;
|
let func_desc = self.parse_comma_separated(Parser::parse_drop_function_desc)?;
|
||||||
|
@ -3019,8 +3023,10 @@ impl<'a> Parser<'a> {
|
||||||
Ok(DropFunctionDesc { name, args })
|
Ok(DropFunctionDesc { name, args })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ```sql
|
||||||
/// DECLARE name [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ]
|
/// DECLARE name [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ]
|
||||||
// CURSOR [ { WITH | WITHOUT } HOLD ] FOR query
|
/// CURSOR [ { WITH | WITHOUT } HOLD ] FOR query
|
||||||
|
/// ```
|
||||||
pub fn parse_declare(&mut self) -> Result<Statement, ParserError> {
|
pub fn parse_declare(&mut self) -> Result<Statement, ParserError> {
|
||||||
let name = self.parse_identifier()?;
|
let name = self.parse_identifier()?;
|
||||||
|
|
||||||
|
@ -4822,7 +4828,7 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
/// Parse a "query body", which is an expression with roughly the
|
/// Parse a "query body", which is an expression with roughly the
|
||||||
/// following grammar:
|
/// following grammar:
|
||||||
/// ```text
|
/// ```sql
|
||||||
/// query_body ::= restricted_select | '(' subquery ')' | set_operation
|
/// query_body ::= restricted_select | '(' subquery ')' | set_operation
|
||||||
/// restricted_select ::= 'SELECT' [expr_list] [ from ] [ where ] [ groupby_having ]
|
/// restricted_select ::= 'SELECT' [expr_list] [ from ] [ where ] [ groupby_having ]
|
||||||
/// subquery ::= query_body [ order_by_limit ]
|
/// subquery ::= query_body [ order_by_limit ]
|
||||||
|
@ -6130,7 +6136,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a TOP clause, MSSQL equivalent of LIMIT,
|
/// Parse a TOP clause, MSSQL equivalent of LIMIT,
|
||||||
/// that follows after SELECT [DISTINCT].
|
/// that follows after `SELECT [DISTINCT]`.
|
||||||
pub fn parse_top(&mut self) -> Result<Top, ParserError> {
|
pub fn parse_top(&mut self) -> Result<Top, ParserError> {
|
||||||
let quantity = if self.consume_token(&Token::LParen) {
|
let quantity = if self.consume_token(&Token::LParen) {
|
||||||
let quantity = self.parse_expr()?;
|
let quantity = self.parse_expr()?;
|
||||||
|
@ -6449,8 +6455,11 @@ impl<'a> Parser<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.postgresql.org/docs/current/sql-createsequence.html
|
/// ```sql
|
||||||
/// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>
|
/// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// See [Postgres docs](https://www.postgresql.org/docs/current/sql-createsequence.html) for more details.
|
||||||
pub fn parse_create_sequence(&mut self, temporary: bool) -> Result<Statement, ParserError> {
|
pub fn parse_create_sequence(&mut self, temporary: bool) -> Result<Statement, ParserError> {
|
||||||
//[ IF NOT EXISTS ]
|
//[ IF NOT EXISTS ]
|
||||||
let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
|
let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue