Enum sqlparser::ast::Statement[][src]

pub enum Statement {
    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,
    },
    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_name: ObjectName,
        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 {
        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>,
    },
    ShowColumns {
        extended: bool,
        full: bool,
        table_name: ObjectName,
        filter: Option<ShowStatementFilter>,
    },
    StartTransaction {
        modes: Vec<TransactionMode>,
    },
    SetTransaction {
        modes: Vec<TransactionMode>,
    },
    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>,
    },
    Deallocate {
        name: Ident,
        prepare: bool,
    },
    Execute {
        name: Ident,
        parameters: Vec<Expr>,
    },
    Prepare {
        name: Ident,
        data_types: Vec<DataType>,
        statement: Box<Statement>,
    },
    Explain {
        analyze: bool,
        verbose: bool,
        statement: Box<Statement>,
    },
}

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

Variants

Analyze

Analyze (Hive)

Fields of Analyze

table_name: ObjectNamepartitions: Option<Vec<Expr>>for_columns: boolcolumns: Vec<Ident>cache_metadata: boolnoscan: boolcompute_statistics: bool
Truncate

Truncate (Hive)

Fields of Truncate

table_name: ObjectNamepartitions: Option<Vec<Expr>>
Msck

Msck (Hive)

Fields of Msck

table_name: ObjectNamerepair: boolpartition_action: Option<AddDropSync>
Query(Box<Query>)

SELECT

Insert

INSERT

Fields of Insert

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 of Directory

overwrite: boollocal: boolpath: Stringfile_format: Option<FileFormat>source: Box<Query>
Copy

Fields of Copy

table_name: ObjectName

TABLE

columns: Vec<Ident>

COLUMNS

values: Vec<Option<String>>

VALUES a vector of values to be copied

Update

UPDATE

Fields of Update

table_name: ObjectName

TABLE

assignments: Vec<Assignment>

Column assignments

selection: Option<Expr>

WHERE

Delete

DELETE

Fields of Delete

table_name: ObjectName

FROM

selection: Option<Expr>

WHERE

CreateView

CREATE VIEW

Fields of CreateView

or_replace: boolmaterialized: boolname: ObjectName

View name

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

CREATE TABLE

Fields of CreateTable

or_replace: booltemporary: boolexternal: boolif_not_exists: boolname: ObjectName

Table name

columns: Vec<ColumnDef>

Optional schema

constraints: Vec<TableConstraint>hive_distribution: HiveDistributionStylehive_formats: Option<HiveFormat>table_properties: Vec<SqlOption>with_options: Vec<SqlOption>file_format: Option<FileFormat>location: Option<String>query: Option<Box<Query>>without_rowid: boollike: Option<ObjectName>
CreateVirtualTable

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

Fields of CreateVirtualTable

name: ObjectNameif_not_exists: boolmodule_name: Identmodule_args: Vec<Ident>
CreateIndex

CREATE INDEX

Fields of CreateIndex

name: ObjectName

index name

table_name: ObjectNamecolumns: Vec<OrderByExpr>unique: boolif_not_exists: bool
AlterTable

ALTER TABLE

Fields of AlterTable

name: ObjectName

Table name

operation: AlterTableOperation
Drop

DROP

Fields of Drop

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 of SetVariable

local: boolhivevar: boolvariable: Identvalue: Vec<SetVariableValue>
ShowVariable

SHOW

Note: this is a PostgreSQL-specific statement.

Fields of ShowVariable

variable: Vec<Ident>
ShowColumns

SHOW COLUMNS

Note: this is a MySQL-specific statement.

Fields of ShowColumns

extended: boolfull: booltable_name: ObjectNamefilter: Option<ShowStatementFilter>
StartTransaction

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

Fields of StartTransaction

modes: Vec<TransactionMode>
SetTransaction

SET TRANSACTION ...

Fields of SetTransaction

modes: Vec<TransactionMode>
Commit

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

Fields of Commit

chain: bool
Rollback

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

Fields of Rollback

chain: bool
CreateSchema

CREATE SCHEMA

Fields of CreateSchema

schema_name: ObjectNameif_not_exists: bool
CreateDatabase

CREATE DATABASE

Fields of CreateDatabase

db_name: ObjectNameif_not_exists: boollocation: Option<String>managed_location: Option<String>
Assert

ASSERT <condition> [AS <message>]

Fields of Assert

condition: Exprmessage: Option<Expr>
Deallocate

DEALLOCATE [ PREPARE ] { name | ALL }

Note: this is a PostgreSQL-specific statement.

Fields of Deallocate

name: Identprepare: bool
Execute

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

Note: this is a PostgreSQL-specific statement.

Fields of Execute

name: Identparameters: Vec<Expr>
Prepare

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

Note: this is a PostgreSQL-specific statement.

Fields of Prepare

name: Identdata_types: Vec<DataType>statement: Box<Statement>
Explain

EXPLAIN

Fields of Explain

analyze: bool

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

verbose: boolstatement: Box<Statement>

A SQL query that specifies what to explain

Trait Implementations

impl Clone for Statement[src]

impl Debug for Statement[src]

impl Display for Statement[src]

impl Eq for Statement[src]

impl Hash for Statement[src]

impl PartialEq<Statement> for Statement[src]

impl StructuralEq for Statement[src]

impl StructuralPartialEq for Statement[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.