pub enum Statement {
Show 36 variants Analyze { table_name: ObjectName, partitions: Option<Vec<Expr>>, for_columns: bool, columns: Vec<Ident>, cache_metadata: bool, noscan: bool, compute_statistics: bool, }, Truncate { table_name: ObjectName, partitions: Option<Vec<Expr>>, }, Msck { table_name: ObjectName, repair: bool, partition_action: Option<AddDropSync>, }, Query(Box<Query>), Insert { or: Option<SqliteOnConflict>, table_name: ObjectName, columns: Vec<Ident>, overwrite: bool, source: Box<Query>, partitioned: Option<Vec<Expr>>, after_columns: Vec<Ident>, table: bool, on: Option<OnInsert>, }, Directory { overwrite: bool, local: bool, path: String, file_format: Option<FileFormat>, source: Box<Query>, }, Copy { table_name: ObjectName, columns: Vec<Ident>, to: bool, target: CopyTarget, options: Vec<CopyOption>, legacy_options: Vec<CopyLegacyOption>, values: Vec<Option<String>>, }, Update { table: TableWithJoins, assignments: Vec<Assignment>, from: Option<TableWithJoins>, selection: Option<Expr>, }, Delete { table_name: ObjectName, selection: Option<Expr>, }, CreateView { or_replace: bool, materialized: bool, name: ObjectName, columns: Vec<Ident>, query: Box<Query>, with_options: Vec<SqlOption>, }, CreateTable {
Show 19 fields or_replace: bool, temporary: bool, external: bool, if_not_exists: bool, name: ObjectName, columns: Vec<ColumnDef>, constraints: Vec<TableConstraint>, hive_distribution: HiveDistributionStyle, hive_formats: Option<HiveFormat>, table_properties: Vec<SqlOption>, with_options: Vec<SqlOption>, file_format: Option<FileFormat>, location: Option<String>, query: Option<Box<Query>>, without_rowid: bool, like: Option<ObjectName>, engine: Option<String>, default_charset: Option<String>, collation: Option<String>,
}, CreateVirtualTable { name: ObjectName, if_not_exists: bool, module_name: Ident, module_args: Vec<Ident>, }, CreateIndex { name: ObjectName, table_name: ObjectName, columns: Vec<OrderByExpr>, unique: bool, if_not_exists: bool, }, AlterTable { name: ObjectName, operation: AlterTableOperation, }, Drop { object_type: ObjectType, if_exists: bool, names: Vec<ObjectName>, cascade: bool, purge: bool, }, SetVariable { local: bool, hivevar: bool, variable: Ident, value: Vec<SetVariableValue>, }, ShowVariable { variable: Vec<Ident>, }, ShowCreate { obj_type: ShowCreateObject, obj_name: ObjectName, }, ShowColumns { extended: bool, full: bool, table_name: ObjectName, filter: Option<ShowStatementFilter>, }, StartTransaction { modes: Vec<TransactionMode>, }, SetTransaction { modes: Vec<TransactionMode>, snapshot: Option<Value>, session: bool, }, Comment { object_type: CommentObject, object_name: ObjectName, comment: Option<String>, }, Commit { chain: bool, }, Rollback { chain: bool, }, CreateSchema { schema_name: ObjectName, if_not_exists: bool, }, CreateDatabase { db_name: ObjectName, if_not_exists: bool, location: Option<String>, managed_location: Option<String>, }, Assert { condition: Expr, message: Option<Expr>, }, Grant { privileges: Privileges, objects: GrantObjects, grantees: Vec<Ident>, with_grant_option: bool, granted_by: Option<Ident>, }, Revoke { privileges: Privileges, objects: GrantObjects, grantees: Vec<Ident>, granted_by: Option<Ident>, cascade: bool, }, Deallocate { name: Ident, prepare: bool, }, Execute { name: Ident, parameters: Vec<Expr>, }, Prepare { name: Ident, data_types: Vec<DataType>, statement: Box<Statement>, }, ExplainTable { describe_alias: bool, table_name: ObjectName, }, Explain { describe_alias: bool, analyze: bool, verbose: bool, statement: Box<Statement>, }, Savepoint { name: Ident, }, Merge { table: TableFactor, source: Box<SetExpr>, alias: Option<TableAlias>, on: Box<Expr>, clauses: Vec<MergeClause>, },
}
Expand description

A top-level statement (SELECT, INSERT, CREATE, etc.)

Variants

Analyze

Fields

table_name: ObjectName
partitions: Option<Vec<Expr>>
for_columns: bool
columns: Vec<Ident>
cache_metadata: bool
noscan: bool
compute_statistics: bool

Analyze (Hive)

Truncate

Fields

table_name: ObjectName
partitions: Option<Vec<Expr>>

Truncate (Hive)

Msck

Fields

table_name: ObjectName
repair: bool
partition_action: Option<AddDropSync>

Msck (Hive)

Query(Box<Query>)

SELECT

Insert

Fields

or: Option<SqliteOnConflict>

Only for Sqlite

table_name: ObjectName

TABLE

columns: Vec<Ident>

COLUMNS

overwrite: bool

Overwrite (Hive)

source: Box<Query>

A SQL query that specifies what to insert

partitioned: Option<Vec<Expr>>

partitioned insert (Hive)

after_columns: Vec<Ident>

Columns defined after PARTITION

table: bool

whether the insert has the table keyword (Hive)

INSERT

Directory

Fields

overwrite: bool
local: bool
path: String
file_format: Option<FileFormat>
source: Box<Query>

Copy

Fields

table_name: ObjectName

TABLE

columns: Vec<Ident>

COLUMNS

to: bool

If true, is a ‘COPY TO’ statement. If false is a ‘COPY FROM’

target: CopyTarget

The source of ‘COPY FROM’, or the target of ‘COPY TO’

options: Vec<CopyOption>

WITH options (from PostgreSQL version 9.0)

legacy_options: Vec<CopyLegacyOption>

WITH options (before PostgreSQL version 9.0)

values: Vec<Option<String>>

VALUES a vector of values to be copied

Update

Fields

table: TableWithJoins

TABLE

assignments: Vec<Assignment>

Column assignments

from: Option<TableWithJoins>

Table which provide value to be set

selection: Option<Expr>

WHERE

UPDATE

Delete

Fields

table_name: ObjectName

FROM

selection: Option<Expr>

WHERE

DELETE

CreateView

Fields

or_replace: bool
materialized: bool
name: ObjectName

View name

columns: Vec<Ident>
query: Box<Query>
with_options: Vec<SqlOption>

CREATE VIEW

CreateTable

Fields

or_replace: bool
temporary: bool
external: bool
if_not_exists: bool
name: ObjectName

Table name

columns: Vec<ColumnDef>

Optional schema

constraints: Vec<TableConstraint>
hive_distribution: HiveDistributionStyle
hive_formats: Option<HiveFormat>
table_properties: Vec<SqlOption>
with_options: Vec<SqlOption>
file_format: Option<FileFormat>
location: Option<String>
query: Option<Box<Query>>
without_rowid: bool
engine: Option<String>
default_charset: Option<String>
collation: Option<String>

CREATE TABLE

CreateVirtualTable

Fields

name: ObjectName
if_not_exists: bool
module_name: Ident
module_args: Vec<Ident>

SQLite’s CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)

CreateIndex

Fields

name: ObjectName

index name

table_name: ObjectName
columns: Vec<OrderByExpr>
unique: bool
if_not_exists: bool

CREATE INDEX

AlterTable

Fields

name: ObjectName

Table name

ALTER TABLE

Drop

Fields

object_type: ObjectType

The type of the object to drop: TABLE, VIEW, etc.

if_exists: bool

An optional IF EXISTS clause. (Non-standard.)

names: Vec<ObjectName>

One or more objects to drop. (ANSI SQL requires exactly one.)

cascade: bool

Whether CASCADE was specified. This will be false when RESTRICT or no drop behavior at all was specified.

purge: bool

Hive allows you specify whether the table’s stored data will be deleted along with the dropped table

DROP

SetVariable

Fields

local: bool
hivevar: bool
variable: Ident

SET

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 supported yet.

ShowVariable

Fields

variable: Vec<Ident>

SHOW

Note: this is a PostgreSQL-specific statement.

ShowCreate

Fields

obj_type: ShowCreateObject
obj_name: ObjectName

SHOW CREATE TABLE

Note: this is a MySQL-specific statement.

ShowColumns

Fields

extended: bool
full: bool
table_name: ObjectName

SHOW COLUMNS

Note: this is a MySQL-specific statement.

StartTransaction

Fields

{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...

SetTransaction

Fields

snapshot: Option<Value>
session: bool

SET TRANSACTION ...

Comment

Fields

object_type: CommentObject
object_name: ObjectName
comment: Option<String>

COMMENT ON ...

Note: this is a PostgreSQL-specific statement.

Commit

Fields

chain: bool

COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]

Rollback

Fields

chain: bool

ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]

CreateSchema

Fields

schema_name: ObjectName
if_not_exists: bool

CREATE SCHEMA

CreateDatabase

Fields

db_name: ObjectName
if_not_exists: bool
location: Option<String>
managed_location: Option<String>

CREATE DATABASE

Assert

Fields

condition: Expr
message: Option<Expr>

ASSERT <condition> [AS <message>]

Grant

Fields

privileges: Privileges
objects: GrantObjects
grantees: Vec<Ident>
with_grant_option: bool
granted_by: Option<Ident>

GRANT privileges ON objects TO grantees

Revoke

Fields

privileges: Privileges
objects: GrantObjects
grantees: Vec<Ident>
granted_by: Option<Ident>
cascade: bool

REVOKE privileges ON objects FROM grantees

Deallocate

Fields

name: Ident
prepare: bool

DEALLOCATE [ PREPARE ] { name | ALL }

Note: this is a PostgreSQL-specific statement.

Execute

Fields

name: Ident
parameters: Vec<Expr>

EXECUTE name [ ( parameter [, ...] ) ]

Note: this is a PostgreSQL-specific statement.

Prepare

Fields

name: Ident
data_types: Vec<DataType>
statement: Box<Statement>

PREPARE name [ ( data_type [, ...] ) ] AS statement

Note: this is a PostgreSQL-specific statement.

ExplainTable

Fields

describe_alias: bool
table_name: ObjectName

EXPLAIN TABLE Note: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/explain.html

Explain

Fields

describe_alias: bool
analyze: bool

Carry out the command and show actual run times and other statistics.

verbose: bool
statement: Box<Statement>

A SQL query that specifies what to explain

EXPLAIN / DESCRIBE for select_statement

Savepoint

Fields

name: Ident

SAVEPOINT – define a new savepoint within the current transaction

Merge

Fields

table: TableFactor
source: Box<SetExpr>
on: Box<Expr>
clauses: Vec<MergeClause>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.