mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-28 18:04:05 +00:00
Improve documentation formatting (#1068)
This commit is contained in:
parent
29b4ce81c1
commit
40bc407799
1 changed files with 187 additions and 80 deletions
267
src/ast/mod.rs
267
src/ast/mod.rs
|
@ -431,14 +431,14 @@ pub enum Expr {
|
||||||
op: BinaryOperator,
|
op: BinaryOperator,
|
||||||
right: Box<Expr>,
|
right: Box<Expr>,
|
||||||
},
|
},
|
||||||
/// LIKE
|
/// `[NOT] LIKE <pattern> [ESCAPE <escape_character>]`
|
||||||
Like {
|
Like {
|
||||||
negated: bool,
|
negated: bool,
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
pattern: Box<Expr>,
|
pattern: Box<Expr>,
|
||||||
escape_char: Option<char>,
|
escape_char: Option<char>,
|
||||||
},
|
},
|
||||||
/// ILIKE (case-insensitive LIKE)
|
/// `ILIKE` (case-insensitive `LIKE`)
|
||||||
ILike {
|
ILike {
|
||||||
negated: bool,
|
negated: bool,
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
|
@ -460,13 +460,13 @@ pub enum Expr {
|
||||||
// true for REGEXP, false for RLIKE (no difference in semantics)
|
// true for REGEXP, false for RLIKE (no difference in semantics)
|
||||||
regexp: bool,
|
regexp: bool,
|
||||||
},
|
},
|
||||||
/// Any operation e.g. `foo > ANY(bar)`, comparison operator is one of [=, >, <, =>, =<, !=]
|
/// `ANY` operation e.g. `foo > ANY(bar)`, comparison operator is one of `[=, >, <, =>, =<, !=]`
|
||||||
AnyOp {
|
AnyOp {
|
||||||
left: Box<Expr>,
|
left: Box<Expr>,
|
||||||
compare_op: BinaryOperator,
|
compare_op: BinaryOperator,
|
||||||
right: Box<Expr>,
|
right: Box<Expr>,
|
||||||
},
|
},
|
||||||
/// ALL operation e.g. `foo > ALL(bar)`, comparison operator is one of [=, >, <, =>, =<, !=]
|
/// `ALL` operation e.g. `foo > ALL(bar)`, comparison operator is one of `[=, >, <, =>, =<, !=]`
|
||||||
AllOp {
|
AllOp {
|
||||||
left: Box<Expr>,
|
left: Box<Expr>,
|
||||||
compare_op: BinaryOperator,
|
compare_op: BinaryOperator,
|
||||||
|
@ -474,7 +474,7 @@ pub enum Expr {
|
||||||
},
|
},
|
||||||
/// Unary operation e.g. `NOT foo`
|
/// Unary operation e.g. `NOT foo`
|
||||||
UnaryOp { op: UnaryOperator, expr: Box<Expr> },
|
UnaryOp { op: UnaryOperator, expr: Box<Expr> },
|
||||||
/// CONVERT a value to a different data type or character encoding `CONVERT(foo USING utf8mb4)`
|
/// CONVERT a value to a different data type or character encoding. e.g. `CONVERT(foo USING utf8mb4)`
|
||||||
Convert {
|
Convert {
|
||||||
/// The expression to convert
|
/// The expression to convert
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
|
@ -485,7 +485,7 @@ pub enum Expr {
|
||||||
/// whether the target comes before the expr (MSSQL syntax)
|
/// whether the target comes before the expr (MSSQL syntax)
|
||||||
target_before_value: bool,
|
target_before_value: bool,
|
||||||
},
|
},
|
||||||
/// CAST an expression to a different data type e.g. `CAST(foo AS VARCHAR(123))`
|
/// `CAST` an expression to a different data type e.g. `CAST(foo AS VARCHAR(123))`
|
||||||
Cast {
|
Cast {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
data_type: DataType,
|
data_type: DataType,
|
||||||
|
@ -493,7 +493,7 @@ pub enum Expr {
|
||||||
// https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#formatting_syntax
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#formatting_syntax
|
||||||
format: Option<CastFormat>,
|
format: Option<CastFormat>,
|
||||||
},
|
},
|
||||||
/// TRY_CAST an expression to a different data type e.g. `TRY_CAST(foo AS VARCHAR(123))`
|
/// `TRY_CAST` an expression to a different data type e.g. `TRY_CAST(foo AS VARCHAR(123))`
|
||||||
// this differs from CAST in the choice of how to implement invalid conversions
|
// this differs from CAST in the choice of how to implement invalid conversions
|
||||||
TryCast {
|
TryCast {
|
||||||
expr: Box<Expr>,
|
expr: Box<Expr>,
|
||||||
|
@ -502,7 +502,7 @@ pub enum Expr {
|
||||||
// https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#formatting_syntax
|
// https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#formatting_syntax
|
||||||
format: Option<CastFormat>,
|
format: Option<CastFormat>,
|
||||||
},
|
},
|
||||||
/// SAFE_CAST an expression to a different data type e.g. `SAFE_CAST(foo AS FLOAT64)`
|
/// `SAFE_CAST` an expression to a different data type e.g. `SAFE_CAST(foo AS FLOAT64)`
|
||||||
// only available for BigQuery: https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#safe_casting
|
// only available for BigQuery: https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#safe_casting
|
||||||
// this works the same as `TRY_CAST`
|
// this works the same as `TRY_CAST`
|
||||||
SafeCast {
|
SafeCast {
|
||||||
|
@ -517,6 +517,9 @@ pub enum Expr {
|
||||||
timestamp: Box<Expr>,
|
timestamp: Box<Expr>,
|
||||||
time_zone: String,
|
time_zone: String,
|
||||||
},
|
},
|
||||||
|
/// Extract a field from a timestamp e.g. `EXTRACT(MONTH FROM foo)`
|
||||||
|
///
|
||||||
|
/// Syntax:
|
||||||
/// ```sql
|
/// ```sql
|
||||||
/// EXTRACT(DateTimeField FROM <expr>)
|
/// EXTRACT(DateTimeField FROM <expr>)
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -665,8 +668,6 @@ pub enum Expr {
|
||||||
/// <col> = CompoundIdentifier
|
/// <col> = CompoundIdentifier
|
||||||
/// <expr> = String literal
|
/// <expr> = String literal
|
||||||
/// ```
|
/// ```
|
||||||
///
|
|
||||||
///
|
|
||||||
/// [(1)]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html#function_match
|
/// [(1)]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html#function_match
|
||||||
MatchAgainst {
|
MatchAgainst {
|
||||||
/// `(<col>, <col>, ...)`.
|
/// `(<col>, <col>, ...)`.
|
||||||
|
@ -1375,6 +1376,9 @@ pub enum Password {
|
||||||
visit(with = "visit_statement")
|
visit(with = "visit_statement")
|
||||||
)]
|
)]
|
||||||
pub enum Statement {
|
pub enum Statement {
|
||||||
|
/// ```sql
|
||||||
|
/// ANALYZE
|
||||||
|
/// ```
|
||||||
/// Analyze (Hive)
|
/// Analyze (Hive)
|
||||||
Analyze {
|
Analyze {
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
|
@ -1386,6 +1390,9 @@ pub enum Statement {
|
||||||
noscan: bool,
|
noscan: bool,
|
||||||
compute_statistics: bool,
|
compute_statistics: bool,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
|
/// TRUNCATE
|
||||||
|
/// ```
|
||||||
/// Truncate (Hive)
|
/// Truncate (Hive)
|
||||||
Truncate {
|
Truncate {
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
|
@ -1394,6 +1401,9 @@ pub enum Statement {
|
||||||
/// TABLE - optional keyword;
|
/// TABLE - optional keyword;
|
||||||
table: bool,
|
table: bool,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
|
/// MSCK
|
||||||
|
/// ```
|
||||||
/// Msck (Hive)
|
/// Msck (Hive)
|
||||||
Msck {
|
Msck {
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
|
@ -1401,9 +1411,13 @@ pub enum Statement {
|
||||||
repair: bool,
|
repair: bool,
|
||||||
partition_action: Option<AddDropSync>,
|
partition_action: Option<AddDropSync>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SELECT
|
/// SELECT
|
||||||
|
/// ```
|
||||||
Query(Box<Query>),
|
Query(Box<Query>),
|
||||||
|
/// ```sql
|
||||||
/// INSERT
|
/// INSERT
|
||||||
|
/// ```
|
||||||
Insert {
|
Insert {
|
||||||
/// Only for Sqlite
|
/// Only for Sqlite
|
||||||
or: Option<SqliteOnConflict>,
|
or: Option<SqliteOnConflict>,
|
||||||
|
@ -1438,7 +1452,13 @@ pub enum Statement {
|
||||||
file_format: Option<FileFormat>,
|
file_format: Option<FileFormat>,
|
||||||
source: Box<Query>,
|
source: Box<Query>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
|
/// CALL <function>
|
||||||
|
/// ```
|
||||||
Call(Function),
|
Call(Function),
|
||||||
|
/// ```sql
|
||||||
|
/// COPY [TO | FROM] ...
|
||||||
|
/// ```
|
||||||
Copy {
|
Copy {
|
||||||
/// The source of 'COPY TO', or the target of 'COPY FROM'
|
/// The source of 'COPY TO', or the target of 'COPY FROM'
|
||||||
source: CopySource,
|
source: CopySource,
|
||||||
|
@ -1473,12 +1493,17 @@ pub enum Statement {
|
||||||
copy_options: DataLoadingOptions,
|
copy_options: DataLoadingOptions,
|
||||||
validation_mode: Option<String>,
|
validation_mode: Option<String>,
|
||||||
},
|
},
|
||||||
/// Close - closes the portal underlying an open cursor.
|
/// ```sql
|
||||||
|
/// CLOSE
|
||||||
|
/// ```
|
||||||
|
/// Closes the portal underlying an open cursor.
|
||||||
Close {
|
Close {
|
||||||
/// Cursor name
|
/// Cursor name
|
||||||
cursor: CloseCursor,
|
cursor: CloseCursor,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// UPDATE
|
/// UPDATE
|
||||||
|
/// ```
|
||||||
Update {
|
Update {
|
||||||
/// TABLE
|
/// TABLE
|
||||||
table: TableWithJoins,
|
table: TableWithJoins,
|
||||||
|
@ -1491,7 +1516,9 @@ pub enum Statement {
|
||||||
/// RETURNING
|
/// RETURNING
|
||||||
returning: Option<Vec<SelectItem>>,
|
returning: Option<Vec<SelectItem>>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// DELETE
|
/// DELETE
|
||||||
|
/// ```
|
||||||
Delete {
|
Delete {
|
||||||
/// Multi tables delete are supported in mysql
|
/// Multi tables delete are supported in mysql
|
||||||
tables: Vec<ObjectName>,
|
tables: Vec<ObjectName>,
|
||||||
|
@ -1508,7 +1535,9 @@ pub enum Statement {
|
||||||
/// LIMIT (MySQL)
|
/// LIMIT (MySQL)
|
||||||
limit: Option<Expr>,
|
limit: Option<Expr>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CREATE VIEW
|
/// CREATE VIEW
|
||||||
|
/// ```
|
||||||
CreateView {
|
CreateView {
|
||||||
or_replace: bool,
|
or_replace: bool,
|
||||||
materialized: bool,
|
materialized: bool,
|
||||||
|
@ -1525,7 +1554,9 @@ pub enum Statement {
|
||||||
/// if true, has SQLite `TEMP` or `TEMPORARY` clause <https://www.sqlite.org/lang_createview.html>
|
/// if true, has SQLite `TEMP` or `TEMPORARY` clause <https://www.sqlite.org/lang_createview.html>
|
||||||
temporary: bool,
|
temporary: bool,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CREATE TABLE
|
/// CREATE TABLE
|
||||||
|
/// ```
|
||||||
CreateTable {
|
CreateTable {
|
||||||
or_replace: bool,
|
or_replace: bool,
|
||||||
temporary: bool,
|
temporary: bool,
|
||||||
|
@ -1567,7 +1598,10 @@ pub enum Statement {
|
||||||
/// then strict typing rules apply to that table.
|
/// then strict typing rules apply to that table.
|
||||||
strict: bool,
|
strict: bool,
|
||||||
},
|
},
|
||||||
/// SQLite's `CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)`
|
/// ```sql
|
||||||
|
/// CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)`
|
||||||
|
/// ```
|
||||||
|
/// Sqlite specific statement
|
||||||
CreateVirtualTable {
|
CreateVirtualTable {
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
name: ObjectName,
|
name: ObjectName,
|
||||||
|
@ -1575,7 +1609,9 @@ pub enum Statement {
|
||||||
module_name: Ident,
|
module_name: Ident,
|
||||||
module_args: Vec<Ident>,
|
module_args: Vec<Ident>,
|
||||||
},
|
},
|
||||||
/// CREATE INDEX
|
/// ```sql
|
||||||
|
/// `CREATE INDEX`
|
||||||
|
/// ```
|
||||||
CreateIndex {
|
CreateIndex {
|
||||||
/// index name
|
/// index name
|
||||||
name: Option<ObjectName>,
|
name: Option<ObjectName>,
|
||||||
|
@ -1590,7 +1626,9 @@ pub enum Statement {
|
||||||
nulls_distinct: Option<bool>,
|
nulls_distinct: Option<bool>,
|
||||||
predicate: Option<Expr>,
|
predicate: Option<Expr>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CREATE ROLE
|
/// CREATE ROLE
|
||||||
|
/// ```
|
||||||
/// See [postgres](https://www.postgresql.org/docs/current/sql-createrole.html)
|
/// See [postgres](https://www.postgresql.org/docs/current/sql-createrole.html)
|
||||||
CreateRole {
|
CreateRole {
|
||||||
names: Vec<ObjectName>,
|
names: Vec<ObjectName>,
|
||||||
|
@ -1614,7 +1652,9 @@ pub enum Statement {
|
||||||
// MSSQL
|
// MSSQL
|
||||||
authorization_owner: Option<ObjectName>,
|
authorization_owner: Option<ObjectName>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// ALTER TABLE
|
/// ALTER TABLE
|
||||||
|
/// ```
|
||||||
AlterTable {
|
AlterTable {
|
||||||
/// Table name
|
/// Table name
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
|
@ -1623,11 +1663,16 @@ pub enum Statement {
|
||||||
only: bool,
|
only: bool,
|
||||||
operations: Vec<AlterTableOperation>,
|
operations: Vec<AlterTableOperation>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
|
/// ALTER INDEX
|
||||||
|
/// ```
|
||||||
AlterIndex {
|
AlterIndex {
|
||||||
name: ObjectName,
|
name: ObjectName,
|
||||||
operation: AlterIndexOperation,
|
operation: AlterIndexOperation,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// ALTER VIEW
|
/// ALTER VIEW
|
||||||
|
/// ```
|
||||||
AlterView {
|
AlterView {
|
||||||
/// View name
|
/// View name
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
|
@ -1636,12 +1681,16 @@ pub enum Statement {
|
||||||
query: Box<Query>,
|
query: Box<Query>,
|
||||||
with_options: Vec<SqlOption>,
|
with_options: Vec<SqlOption>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// ALTER ROLE
|
/// ALTER ROLE
|
||||||
|
/// ```
|
||||||
AlterRole {
|
AlterRole {
|
||||||
name: Ident,
|
name: Ident,
|
||||||
operation: AlterRoleOperation,
|
operation: AlterRoleOperation,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// ATTACH DATABASE 'path/to/file' AS alias
|
/// ATTACH DATABASE 'path/to/file' AS alias
|
||||||
|
/// ```
|
||||||
/// (SQLite-specific)
|
/// (SQLite-specific)
|
||||||
AttachDatabase {
|
AttachDatabase {
|
||||||
/// The name to bind to the newly attached database
|
/// The name to bind to the newly attached database
|
||||||
|
@ -1651,7 +1700,9 @@ pub enum Statement {
|
||||||
/// true if the syntax is 'ATTACH DATABASE', false if it's just 'ATTACH'
|
/// true if the syntax is 'ATTACH DATABASE', false if it's just 'ATTACH'
|
||||||
database: bool,
|
database: bool,
|
||||||
},
|
},
|
||||||
/// DROP
|
/// ```sql
|
||||||
|
/// DROP [TABLE, VIEW, ...]
|
||||||
|
/// ```
|
||||||
Drop {
|
Drop {
|
||||||
/// The type of the object to drop: TABLE, VIEW, etc.
|
/// The type of the object to drop: TABLE, VIEW, etc.
|
||||||
object_type: ObjectType,
|
object_type: ObjectType,
|
||||||
|
@ -1671,7 +1722,9 @@ pub enum Statement {
|
||||||
/// MySQL-specific "TEMPORARY" keyword
|
/// MySQL-specific "TEMPORARY" keyword
|
||||||
temporary: bool,
|
temporary: bool,
|
||||||
},
|
},
|
||||||
/// DROP Function
|
/// ```sql
|
||||||
|
/// DROP FUNCTION
|
||||||
|
/// ```
|
||||||
DropFunction {
|
DropFunction {
|
||||||
if_exists: bool,
|
if_exists: bool,
|
||||||
/// One or more function to drop
|
/// One or more function to drop
|
||||||
|
@ -1679,7 +1732,10 @@ pub enum Statement {
|
||||||
/// `CASCADE` or `RESTRICT`
|
/// `CASCADE` or `RESTRICT`
|
||||||
option: Option<ReferentialAction>,
|
option: Option<ReferentialAction>,
|
||||||
},
|
},
|
||||||
/// DECLARE - Declaring Cursor Variables
|
/// ```sql
|
||||||
|
/// DECLARE
|
||||||
|
/// ```
|
||||||
|
/// Declare Cursor Variables
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement,
|
/// Note: this is a PostgreSQL-specific statement,
|
||||||
/// but may also compatible with other SQL.
|
/// but may also compatible with other SQL.
|
||||||
|
@ -1702,7 +1758,10 @@ pub enum Statement {
|
||||||
hold: Option<bool>,
|
hold: Option<bool>,
|
||||||
query: Box<Query>,
|
query: Box<Query>,
|
||||||
},
|
},
|
||||||
/// FETCH - retrieve rows from a query using a cursor
|
/// ```sql
|
||||||
|
/// FETCH
|
||||||
|
/// ```
|
||||||
|
/// Retrieve rows from a query using a cursor
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement,
|
/// Note: this is a PostgreSQL-specific statement,
|
||||||
/// but may also compatible with other SQL.
|
/// but may also compatible with other SQL.
|
||||||
|
@ -1713,14 +1772,18 @@ pub enum Statement {
|
||||||
/// Optional, It's possible to fetch rows form cursor to the table
|
/// Optional, It's possible to fetch rows form cursor to the table
|
||||||
into: Option<ObjectName>,
|
into: Option<ObjectName>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// DISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ]
|
/// DISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ]
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement,
|
/// Note: this is a PostgreSQL-specific statement,
|
||||||
/// but may also compatible with other SQL.
|
/// but may also compatible with other SQL.
|
||||||
Discard {
|
Discard { object_type: DiscardObject },
|
||||||
object_type: DiscardObject,
|
/// ```sql
|
||||||
},
|
/// SET [ SESSION | LOCAL ] ROLE role_name
|
||||||
/// SET `[ SESSION | LOCAL ]` ROLE role_name. Examples: [ANSI][1], [Postgresql][2], [MySQL][3], and [Oracle][4].
|
/// ```
|
||||||
|
///
|
||||||
|
/// Sets sesssion state. Examples: [ANSI][1], [Postgresql][2], [MySQL][3], and [Oracle][4]
|
||||||
///
|
///
|
||||||
/// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#set-role-statement
|
/// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#set-role-statement
|
||||||
/// [2]: https://www.postgresql.org/docs/14/sql-set-role.html
|
/// [2]: https://www.postgresql.org/docs/14/sql-set-role.html
|
||||||
|
@ -1751,36 +1814,35 @@ pub enum Statement {
|
||||||
///
|
///
|
||||||
/// 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 {
|
SetTimeZone { local: bool, value: Expr },
|
||||||
local: bool,
|
/// ```sql
|
||||||
value: Expr,
|
|
||||||
},
|
|
||||||
/// SET NAMES 'charset_name' [COLLATE 'collation_name']
|
/// SET NAMES 'charset_name' [COLLATE 'collation_name']
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
SetNames {
|
SetNames {
|
||||||
charset_name: String,
|
charset_name: String,
|
||||||
collation_name: Option<String>,
|
collation_name: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SET NAMES DEFAULT
|
/// SET NAMES DEFAULT
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
SetNamesDefault {},
|
SetNamesDefault {},
|
||||||
/// SHOW FUNCTIONS
|
/// `SHOW FUNCTIONS`
|
||||||
///
|
///
|
||||||
/// Note: this is a Presto-specific statement.
|
/// Note: this is a Presto-specific statement.
|
||||||
ShowFunctions {
|
ShowFunctions { filter: Option<ShowStatementFilter> },
|
||||||
filter: Option<ShowStatementFilter>,
|
|
||||||
},
|
|
||||||
/// ```sql
|
/// ```sql
|
||||||
/// SHOW <variable>
|
/// SHOW <variable>
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement.
|
/// Note: this is a PostgreSQL-specific statement.
|
||||||
ShowVariable {
|
ShowVariable { variable: Vec<Ident> },
|
||||||
variable: Vec<Ident>,
|
/// ```sql
|
||||||
},
|
|
||||||
/// SHOW VARIABLES
|
/// SHOW VARIABLES
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
ShowVariables {
|
ShowVariables {
|
||||||
|
@ -1788,14 +1850,18 @@ pub enum Statement {
|
||||||
global: bool,
|
global: bool,
|
||||||
session: bool,
|
session: bool,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SHOW CREATE TABLE
|
/// SHOW CREATE TABLE
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
ShowCreate {
|
ShowCreate {
|
||||||
obj_type: ShowCreateObject,
|
obj_type: ShowCreateObject,
|
||||||
obj_name: ObjectName,
|
obj_name: ObjectName,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SHOW COLUMNS
|
/// SHOW COLUMNS
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
ShowColumns {
|
ShowColumns {
|
||||||
|
@ -1805,8 +1871,9 @@ pub enum Statement {
|
||||||
table_name: ObjectName,
|
table_name: ObjectName,
|
||||||
filter: Option<ShowStatementFilter>,
|
filter: Option<ShowStatementFilter>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SHOW TABLES
|
/// SHOW TABLES
|
||||||
///
|
/// ```
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
ShowTables {
|
ShowTables {
|
||||||
extended: bool,
|
extended: bool,
|
||||||
|
@ -1814,34 +1881,42 @@ pub enum Statement {
|
||||||
db_name: Option<Ident>,
|
db_name: Option<Ident>,
|
||||||
filter: Option<ShowStatementFilter>,
|
filter: Option<ShowStatementFilter>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// SHOW COLLATION
|
/// SHOW COLLATION
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a MySQL-specific statement.
|
/// Note: this is a MySQL-specific statement.
|
||||||
ShowCollation {
|
ShowCollation { filter: Option<ShowStatementFilter> },
|
||||||
filter: Option<ShowStatementFilter>,
|
/// ```sql
|
||||||
},
|
|
||||||
/// USE
|
/// USE
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: This is a MySQL-specific statement.
|
/// Note: This is a MySQL-specific statement.
|
||||||
Use {
|
Use { db_name: Ident },
|
||||||
db_name: Ident,
|
/// ```sql
|
||||||
},
|
/// START [ TRANSACTION | WORK ] | START TRANSACTION } ...
|
||||||
/// `START [ TRANSACTION | WORK ] | START TRANSACTION } ...`
|
/// ```
|
||||||
/// If `begin` is false.
|
/// If `begin` is false.
|
||||||
///
|
///
|
||||||
|
/// ```sql
|
||||||
/// `BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...`
|
/// `BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...`
|
||||||
|
/// ```
|
||||||
/// If `begin` is true
|
/// If `begin` is true
|
||||||
StartTransaction {
|
StartTransaction {
|
||||||
modes: Vec<TransactionMode>,
|
modes: Vec<TransactionMode>,
|
||||||
begin: bool,
|
begin: bool,
|
||||||
},
|
},
|
||||||
/// `SET TRANSACTION ...`
|
/// ```sql
|
||||||
|
/// SET TRANSACTION ...
|
||||||
|
/// ```
|
||||||
SetTransaction {
|
SetTransaction {
|
||||||
modes: Vec<TransactionMode>,
|
modes: Vec<TransactionMode>,
|
||||||
snapshot: Option<Value>,
|
snapshot: Option<Value>,
|
||||||
session: bool,
|
session: bool,
|
||||||
},
|
},
|
||||||
/// `COMMENT ON ...`
|
/// ```sql
|
||||||
|
/// COMMENT ON ...
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement.
|
/// Note: this is a PostgreSQL-specific statement.
|
||||||
Comment {
|
Comment {
|
||||||
|
@ -1852,22 +1927,28 @@ pub enum Statement {
|
||||||
/// See <https://docs.snowflake.com/en/sql-reference/sql/comment>
|
/// See <https://docs.snowflake.com/en/sql-reference/sql/comment>
|
||||||
if_exists: bool,
|
if_exists: bool,
|
||||||
},
|
},
|
||||||
/// `COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]`
|
/// ```sql
|
||||||
Commit {
|
/// COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
|
||||||
chain: bool,
|
/// ```
|
||||||
},
|
Commit { chain: bool },
|
||||||
/// `ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] [ TO [ SAVEPOINT ] savepoint_name ]`
|
/// ```sql
|
||||||
|
/// ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] [ TO [ SAVEPOINT ] savepoint_name ]
|
||||||
|
/// ```
|
||||||
Rollback {
|
Rollback {
|
||||||
chain: bool,
|
chain: bool,
|
||||||
savepoint: Option<Ident>,
|
savepoint: Option<Ident>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CREATE SCHEMA
|
/// CREATE SCHEMA
|
||||||
|
/// ```
|
||||||
CreateSchema {
|
CreateSchema {
|
||||||
/// `<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>`
|
/// `<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>`
|
||||||
schema_name: SchemaName,
|
schema_name: SchemaName,
|
||||||
if_not_exists: bool,
|
if_not_exists: bool,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// CREATE DATABASE
|
/// CREATE DATABASE
|
||||||
|
/// ```
|
||||||
CreateDatabase {
|
CreateDatabase {
|
||||||
db_name: ObjectName,
|
db_name: ObjectName,
|
||||||
if_not_exists: bool,
|
if_not_exists: bool,
|
||||||
|
@ -1927,12 +2008,16 @@ pub enum Statement {
|
||||||
copy_options: DataLoadingOptions,
|
copy_options: DataLoadingOptions,
|
||||||
comment: Option<String>,
|
comment: Option<String>,
|
||||||
},
|
},
|
||||||
/// `ASSERT <condition> [AS <message>]`
|
/// ```sql
|
||||||
|
/// ASSERT <condition> [AS <message>]
|
||||||
|
/// ```
|
||||||
Assert {
|
Assert {
|
||||||
condition: Expr,
|
condition: Expr,
|
||||||
message: Option<Expr>,
|
message: Option<Expr>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// GRANT privileges ON objects TO grantees
|
/// GRANT privileges ON objects TO grantees
|
||||||
|
/// ```
|
||||||
Grant {
|
Grant {
|
||||||
privileges: Privileges,
|
privileges: Privileges,
|
||||||
objects: GrantObjects,
|
objects: GrantObjects,
|
||||||
|
@ -1940,7 +2025,9 @@ pub enum Statement {
|
||||||
with_grant_option: bool,
|
with_grant_option: bool,
|
||||||
granted_by: Option<Ident>,
|
granted_by: Option<Ident>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// REVOKE privileges ON objects FROM grantees
|
/// REVOKE privileges ON objects FROM grantees
|
||||||
|
/// ```
|
||||||
Revoke {
|
Revoke {
|
||||||
privileges: Privileges,
|
privileges: Privileges,
|
||||||
objects: GrantObjects,
|
objects: GrantObjects,
|
||||||
|
@ -1948,21 +2035,21 @@ pub enum Statement {
|
||||||
granted_by: Option<Ident>,
|
granted_by: Option<Ident>,
|
||||||
cascade: bool,
|
cascade: bool,
|
||||||
},
|
},
|
||||||
/// `DEALLOCATE [ PREPARE ] { name | ALL }`
|
/// ```sql
|
||||||
|
/// DEALLOCATE [ PREPARE ] { name | ALL }
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement.
|
/// Note: this is a PostgreSQL-specific statement.
|
||||||
Deallocate {
|
Deallocate { name: Ident, prepare: bool },
|
||||||
name: Ident,
|
/// ```sql
|
||||||
prepare: bool,
|
/// EXECUTE name [ ( parameter [, ...] ) ]
|
||||||
},
|
/// ```
|
||||||
/// `EXECUTE name [ ( parameter [, ...] ) ]`
|
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement.
|
/// Note: this is a PostgreSQL-specific statement.
|
||||||
Execute {
|
Execute { name: Ident, parameters: Vec<Expr> },
|
||||||
name: Ident,
|
/// ```sql
|
||||||
parameters: Vec<Expr>,
|
/// PREPARE name [ ( data_type [, ...] ) ] AS statement
|
||||||
},
|
/// ```
|
||||||
/// `PREPARE name [ ( data_type [, ...] ) ] AS statement`
|
|
||||||
///
|
///
|
||||||
/// Note: this is a PostgreSQL-specific statement.
|
/// Note: this is a PostgreSQL-specific statement.
|
||||||
Prepare {
|
Prepare {
|
||||||
|
@ -1970,7 +2057,9 @@ pub enum Statement {
|
||||||
data_types: Vec<DataType>,
|
data_types: Vec<DataType>,
|
||||||
statement: Box<Statement>,
|
statement: Box<Statement>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// KILL [CONNECTION | QUERY | MUTATION]
|
/// KILL [CONNECTION | QUERY | MUTATION]
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// See <https://clickhouse.com/docs/ru/sql-reference/statements/kill/>
|
/// See <https://clickhouse.com/docs/ru/sql-reference/statements/kill/>
|
||||||
/// See <https://dev.mysql.com/doc/refman/8.0/en/kill.html>
|
/// See <https://dev.mysql.com/doc/refman/8.0/en/kill.html>
|
||||||
|
@ -1979,7 +2068,9 @@ pub enum Statement {
|
||||||
// processlist_id
|
// processlist_id
|
||||||
id: u64,
|
id: u64,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// EXPLAIN TABLE
|
/// EXPLAIN TABLE
|
||||||
|
/// ```
|
||||||
/// Note: this is a MySQL-specific statement. See <https://dev.mysql.com/doc/refman/8.0/en/explain.html>
|
/// Note: this is a MySQL-specific statement. See <https://dev.mysql.com/doc/refman/8.0/en/explain.html>
|
||||||
ExplainTable {
|
ExplainTable {
|
||||||
/// If true, query used the MySQL `DESCRIBE` alias for explain
|
/// If true, query used the MySQL `DESCRIBE` alias for explain
|
||||||
|
@ -1988,7 +2079,9 @@ pub enum Statement {
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
table_name: ObjectName,
|
table_name: ObjectName,
|
||||||
},
|
},
|
||||||
/// EXPLAIN / DESCRIBE for select_statement
|
/// ```sql
|
||||||
|
/// [EXPLAIN | DESCRIBE <select statement>
|
||||||
|
/// ```
|
||||||
Explain {
|
Explain {
|
||||||
// If true, query used the MySQL `DESCRIBE` alias for explain
|
// If true, query used the MySQL `DESCRIBE` alias for explain
|
||||||
describe_alias: bool,
|
describe_alias: bool,
|
||||||
|
@ -2001,15 +2094,19 @@ pub enum Statement {
|
||||||
/// Optional output format of explain
|
/// Optional output format of explain
|
||||||
format: Option<AnalyzeFormat>,
|
format: Option<AnalyzeFormat>,
|
||||||
},
|
},
|
||||||
/// SAVEPOINT -- define a new savepoint within the current transaction
|
/// ```sql
|
||||||
Savepoint {
|
/// SAVEPOINT
|
||||||
name: Ident,
|
/// ```
|
||||||
},
|
/// Define a new savepoint within the current transaction
|
||||||
/// RELEASE \[ SAVEPOINT \] savepoint_name
|
Savepoint { name: Ident },
|
||||||
ReleaseSavepoint {
|
/// ```sql
|
||||||
name: Ident,
|
/// RELEASE [ SAVEPOINT ] savepoint_name
|
||||||
},
|
/// ```
|
||||||
// MERGE INTO statement, based on Snowflake. See <https://docs.snowflake.com/en/sql-reference/sql/merge.html>
|
ReleaseSavepoint { name: Ident },
|
||||||
|
/// ```sql
|
||||||
|
/// MERGE INTO <statement>
|
||||||
|
/// ```
|
||||||
|
/// Based on Snowflake. See <https://docs.snowflake.com/en/sql-reference/sql/merge.html>
|
||||||
Merge {
|
Merge {
|
||||||
// optional INTO keyword
|
// optional INTO keyword
|
||||||
into: bool,
|
into: bool,
|
||||||
|
@ -2022,7 +2119,9 @@ 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> ]`.
|
/// ```sql
|
||||||
|
/// CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// See [Spark SQL docs] for more details.
|
/// See [Spark SQL docs] for more details.
|
||||||
///
|
///
|
||||||
|
@ -2040,16 +2139,19 @@ pub enum Statement {
|
||||||
/// Cache table as a Query
|
/// Cache table as a Query
|
||||||
query: Option<Query>,
|
query: Option<Query>,
|
||||||
},
|
},
|
||||||
|
/// ```sql
|
||||||
/// UNCACHE TABLE [ IF EXISTS ] <table_name>
|
/// UNCACHE TABLE [ IF EXISTS ] <table_name>
|
||||||
|
/// ```
|
||||||
UNCache {
|
UNCache {
|
||||||
/// Table name
|
/// Table name
|
||||||
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
#[cfg_attr(feature = "visitor", visit(with = "visit_relation"))]
|
||||||
table_name: ObjectName,
|
table_name: ObjectName,
|
||||||
if_exists: bool,
|
if_exists: bool,
|
||||||
},
|
},
|
||||||
/// Define a new sequence:
|
/// ```sql
|
||||||
///
|
|
||||||
/// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>
|
/// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>
|
||||||
|
/// ```
|
||||||
|
/// Define a new sequence:
|
||||||
CreateSequence {
|
CreateSequence {
|
||||||
temporary: bool,
|
temporary: bool,
|
||||||
if_not_exists: bool,
|
if_not_exists: bool,
|
||||||
|
@ -2058,24 +2160,29 @@ pub enum Statement {
|
||||||
sequence_options: Vec<SequenceOptions>,
|
sequence_options: Vec<SequenceOptions>,
|
||||||
owned_by: Option<ObjectName>,
|
owned_by: Option<ObjectName>,
|
||||||
},
|
},
|
||||||
/// CREATE TYPE `<name>`
|
/// ```sql
|
||||||
|
/// CREATE TYPE <name>
|
||||||
|
/// ```
|
||||||
CreateType {
|
CreateType {
|
||||||
name: ObjectName,
|
name: ObjectName,
|
||||||
representation: UserDefinedTypeRepresentation,
|
representation: UserDefinedTypeRepresentation,
|
||||||
},
|
},
|
||||||
// PRAGMA <schema-name>.<pragma-name> = <pragma-value>
|
/// ```sql
|
||||||
|
/// PRAGMA <schema-name>.<pragma-name> = <pragma-value>
|
||||||
|
/// ```
|
||||||
Pragma {
|
Pragma {
|
||||||
name: ObjectName,
|
name: ObjectName,
|
||||||
value: Option<Value>,
|
value: Option<Value>,
|
||||||
is_eq: bool,
|
is_eq: bool,
|
||||||
},
|
},
|
||||||
/// `LOCK TABLES <table_name> [READ [LOCAL] | [LOW_PRIORITY] WRITE]`
|
/// ```sql
|
||||||
///
|
/// LOCK TABLES <table_name> [READ [LOCAL] | [LOW_PRIORITY] WRITE]
|
||||||
|
/// ```
|
||||||
/// Note: this is a MySQL-specific statement. See <https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html>
|
/// Note: this is a MySQL-specific statement. See <https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html>
|
||||||
LockTables {
|
LockTables { tables: Vec<LockTable> },
|
||||||
tables: Vec<LockTable>,
|
/// ```sql
|
||||||
},
|
/// UNLOCK TABLES
|
||||||
/// `UNLOCK TABLES`
|
/// ```
|
||||||
/// Note: this is a MySQL-specific statement. See <https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html>
|
/// Note: this is a MySQL-specific statement. See <https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html>
|
||||||
UnlockTables,
|
UnlockTables,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue