[][src]Enum sql_ast::ast::Statement

pub enum Statement {
    Query(Box<Query>),
    Insert {
        table_name: ObjectName,
        columns: Vec<Ident>,
        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 {
        name: ObjectName,
        columns: Vec<Ident>,
        query: Box<Query>,
        materialized: bool,
        with_options: Vec<SqlOption>,
    },
    CreateTable {
        if_not_exists: bool,
        name: ObjectName,
        columns: Vec<ColumnDef>,
        constraints: Vec<TableConstraint>,
        with_options: Vec<SqlOption>,
        external: bool,
        file_format: Option<FileFormat>,
        location: Option<String>,
    },
    AlterTable {
        name: ObjectName,
        operation: AlterTableOperation,
    },
    Drop {
        object_type: ObjectType,
        if_exists: bool,
        names: Vec<ObjectName>,
        cascade: bool,
    },
    SetVariable {
        local: bool,
        variable: Ident,
        value: SetVariableValue,
    },
    ShowVariable {
        variable: 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,
    },
}

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

Variants

Query(Box<Query>)

SELECT

Insert

INSERT

Fields of Insert

table_name: ObjectName

TABLE

columns: Vec<Ident>

COLUMNS

source: Box<Query>

A SQL query that specifies what to insert

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

name: ObjectName

View name

columns: Vec<Ident>query: Box<Query>materialized: boolwith_options: Vec<SqlOption>
CreateTable

CREATE TABLE

Fields of CreateTable

if_not_exists: boolname: ObjectName

Table name

columns: Vec<ColumnDef>

Optional schema

constraints: Vec<TableConstraint>with_options: Vec<SqlOption>external: boolfile_format: Option<FileFormat>location: Option<String>
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.

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: boolvariable: Identvalue: SetVariableValue
ShowVariable

SHOW

Note: this is a PostgreSQL-specific statement.

Fields of ShowVariable

variable: 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

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.