pub enum Statement {
Show 43 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>,
into: bool,
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>>,
},
Close {
cursor: CloseCursor,
},
Update {
table: TableWithJoins,
assignments: Vec<Assignment>,
from: Option<TableWithJoins>,
selection: Option<Expr>,
},
Delete {
table_name: TableFactor,
using: Option<TableFactor>,
selection: Option<Expr>,
},
CreateView {
or_replace: bool,
materialized: bool,
name: ObjectName,
columns: Vec<Ident>,
query: Box<Query>,
with_options: Vec<SqlOption>,
},
CreateTable {Show 23 fields
or_replace: bool,
temporary: bool,
external: bool,
global: Option<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>,
clone: Option<ObjectName>,
engine: Option<String>,
default_charset: Option<String>,
collation: Option<String>,
on_commit: Option<OnCommit>,
on_cluster: 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,
},
Declare {
name: Ident,
binary: bool,
sensitive: Option<bool>,
scroll: Option<bool>,
hold: Option<bool>,
query: Box<Query>,
},
Fetch {
name: Ident,
direction: FetchDirection,
into: Option<ObjectName>,
},
Discard {
object_type: DiscardObject,
},
SetRole {
local: bool,
session: bool,
role_name: Option<Ident>,
},
SetVariable {
local: bool,
hivevar: bool,
variable: ObjectName,
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>,
},
CreateFunction {
temporary: bool,
name: ObjectName,
class_name: String,
using: Option<CreateFunctionUsing>,
},
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>,
},
Kill {
modifier: Option<KillType>,
id: u64,
},
ExplainTable {
describe_alias: bool,
table_name: ObjectName,
},
Explain {
describe_alias: bool,
analyze: bool,
verbose: bool,
statement: Box<Statement>,
},
Savepoint {
name: Ident,
},
Merge {
into: bool,
table: TableFactor,
source: TableFactor,
on: Box<Expr>,
clauses: Vec<MergeClause>,
},
}Expand description
A top-level statement (SELECT, INSERT, CREATE, etc.)
Variants
Analyze
Fields
table_name: ObjectNamefor_columns: boolcache_metadata: boolnoscan: boolcompute_statistics: boolAnalyze (Hive)
Truncate
Truncate (Hive)
Msck
Msck (Hive)
Query(Box<Query>)
SELECT
Insert
Fields
or: Option<SqliteOnConflict>Only for Sqlite
into: boolINTO - optional keyword
table_name: ObjectNameTABLE
overwrite: boolOverwrite (Hive)
table: boolwhether the insert has the table keyword (Hive)
INSERT
Directory
Copy
Fields
table_name: ObjectNameTABLE
to: boolIf true, is a ‘COPY TO’ statement. If false is a ‘COPY FROM’
target: CopyTargetThe 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)
Close
Fields
cursor: CloseCursorCursor name
Close - closes the portal underlying an open cursor.
Update
Fields
table: TableWithJoinsTABLE
assignments: Vec<Assignment>Column assignments
from: Option<TableWithJoins>Table which provide value to be set
UPDATE
Delete
DELETE
CreateView
CREATE VIEW
CreateTable
Fields
or_replace: booltemporary: boolexternal: boolif_not_exists: boolname: ObjectNameTable name
constraints: Vec<TableConstraint>hive_distribution: HiveDistributionStylehive_formats: Option<HiveFormat>file_format: Option<FileFormat>without_rowid: boollike: Option<ObjectName>clone: Option<ObjectName>on_cluster: Option<String>Click house “ON CLUSTER” clause: https://clickhouse.com/docs/en/sql-reference/distributed-ddl/
CREATE TABLE
CreateVirtualTable
SQLite’s CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)
CreateIndex
Fields
name: ObjectNameindex name
table_name: ObjectNamecolumns: Vec<OrderByExpr>unique: boolif_not_exists: boolCREATE INDEX
AlterTable
ALTER TABLE
Drop
Fields
object_type: ObjectTypeThe type of the object to drop: TABLE, VIEW, etc.
if_exists: boolAn optional IF EXISTS clause. (Non-standard.)
names: Vec<ObjectName>One or more objects to drop. (ANSI SQL requires exactly one.)
cascade: boolWhether CASCADE was specified. This will be false when
RESTRICT or no drop behavior at all was specified.
purge: boolHive allows you specify whether the table’s stored data will be deleted along with the dropped table
DROP
Declare
Fields
name: IdentCursor name
binary: boolCauses the cursor to return data in binary rather than in text format.
DECLARE - Declaring Cursor Variables
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
Fetch
Fields
name: IdentCursor name
direction: FetchDirectioninto: Option<ObjectName>Optional, It’s possible to fetch rows form cursor to the table
FETCH - retrieve rows from a query using a cursor
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
Discard
Fields
object_type: DiscardObjectDISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ]
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
SetRole
SET [ SESSION | LOCAL ] ROLE role_name
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
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.
ShowVariable
SHOW
Note: this is a PostgreSQL-specific statement.
ShowCreate
SHOW CREATE TABLE
Note: this is a MySQL-specific statement.
ShowColumns
SHOW COLUMNS
Note: this is a MySQL-specific statement.
StartTransaction
Fields
modes: Vec<TransactionMode>{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...
SetTransaction
SET TRANSACTION ...
Comment
COMMENT ON ...
Note: this is a PostgreSQL-specific statement.
Commit
Fields
chain: boolCOMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
Rollback
Fields
chain: boolROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
CreateSchema
CREATE SCHEMA
CreateDatabase
CREATE DATABASE
CreateFunction
CREATE FUNCTION
Hive: https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction
Assert
ASSERT <condition> [AS <message>]
Grant
GRANT privileges ON objects TO grantees
Revoke
REVOKE privileges ON objects FROM grantees
Deallocate
DEALLOCATE [ PREPARE ] { name | ALL }
Note: this is a PostgreSQL-specific statement.
Execute
EXECUTE name [ ( parameter [, ...] ) ]
Note: this is a PostgreSQL-specific statement.
Prepare
PREPARE name [ ( data_type [, ...] ) ] AS statement
Note: this is a PostgreSQL-specific statement.
Kill
KILL [CONNECTION | QUERY | MUTATION]
See https://clickhouse.com/docs/ru/sql-reference/statements/kill/ See https://dev.mysql.com/doc/refman/8.0/en/kill.html
ExplainTable
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: boolanalyze: boolCarry out the command and show actual run times and other statistics.
verbose: boolEXPLAIN / DESCRIBE for select_statement
Savepoint
Fields
name: IdentSAVEPOINT – define a new savepoint within the current transaction
Merge
Trait Implementations
impl Eq for Statement
impl StructuralEq for Statement
impl StructuralPartialEq for Statement
Auto Trait Implementations
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more