Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 34 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>, values: Vec<Option<String>>, }, Update { table: TableWithJoins, assignments: Vec<Assignment>, 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 16 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>,
}, 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>, },
}
Expand description

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

Variants§

§

Analyze

Analyze (Hive)

Fields

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

Truncate

Truncate (Hive)

Fields

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

Msck

Msck (Hive)

Fields

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

Query(Box<Query>)

SELECT

§

Insert

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)

§

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

§values: Vec<Option<String>>

VALUES a vector of values to be copied

§

Update

UPDATE

Fields

§table: TableWithJoins

TABLE

§assignments: Vec<Assignment>

Column assignments

§selection: Option<Expr>

WHERE

§

Delete

DELETE

Fields

§table_name: ObjectName

FROM

§selection: Option<Expr>

WHERE

§

CreateView

CREATE VIEW

Fields

§or_replace: bool
§materialized: bool
§name: ObjectName

View name

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

CreateTable

CREATE TABLE

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
§

CreateVirtualTable

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

Fields

§if_not_exists: bool
§module_name: Ident
§module_args: Vec<Ident>
§

CreateIndex

CREATE INDEX

Fields

§name: ObjectName

index name

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

AlterTable

ALTER TABLE

Fields

§name: ObjectName

Table name

§

Drop

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

§

SetVariable

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.

Fields

§local: bool
§hivevar: bool
§variable: Ident
§

ShowVariable

SHOW

Note: this is a PostgreSQL-specific statement.

Fields

§variable: Vec<Ident>
§

ShowCreate

SHOW CREATE TABLE

Note: this is a MySQL-specific statement.

Fields

§obj_name: ObjectName
§

ShowColumns

SHOW COLUMNS

Note: this is a MySQL-specific statement.

Fields

§extended: bool
§full: bool
§table_name: ObjectName
§

StartTransaction

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

Fields

§

SetTransaction

SET TRANSACTION ...

Fields

§snapshot: Option<Value>
§session: bool
§

Comment

COMMENT ON ...

Note: this is a PostgreSQL-specific statement.

Fields

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

Commit

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

Fields

§chain: bool
§

Rollback

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

Fields

§chain: bool
§

CreateSchema

CREATE SCHEMA

Fields

§schema_name: ObjectName
§if_not_exists: bool
§

CreateDatabase

CREATE DATABASE

Fields

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

Assert

ASSERT <condition> [AS <message>]

Fields

§condition: Expr
§message: Option<Expr>
§

Grant

GRANT privileges ON objects TO grantees

Fields

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

Revoke

REVOKE privileges ON objects FROM grantees

Fields

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

Deallocate

DEALLOCATE [ PREPARE ] { name | ALL }

Note: this is a PostgreSQL-specific statement.

Fields

§name: Ident
§prepare: bool
§

Execute

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

Note: this is a PostgreSQL-specific statement.

Fields

§name: Ident
§parameters: Vec<Expr>
§

Prepare

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

Note: this is a PostgreSQL-specific statement.

Fields

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

ExplainTable

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

Fields

§describe_alias: bool
§table_name: ObjectName
§

Explain

EXPLAIN / DESCRIBE for select_statement

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

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Statement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Statement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Statement

Source§

impl Hash for Statement

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl PartialEq for Statement

Source§

fn eq(&self, other: &Statement) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Statement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.