Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 33 variants Query(Box<Query>), CreateTable(Box<CreateTable>), CreateView(Box<CreateView>), CreateFunction(Box<CreateFunction>), CreateTableFunction(Box<CreateTableFunction>), CreateProcedure(Box<CreateProcedure>), CreateSchema(Box<CreateSchema>), Insert(Box<Insert>), Update(Box<Update>), Delete(Box<Delete>), Merge(Box<Merge>), Drop(Box<Drop>), AlterTable(Box<AlterTable>), Truncate { name: ObjectName, }, Declare { names: Vec<Ident>, data_type: Option<DataType>, default: Option<Expr>, }, Set { targets: Vec<Expr>, value: Expr, }, BeginEnd { label: Option<Ident>, body: Vec<Statement>, exception: Option<Vec<Statement>>, }, If { branches: Vec<ConditionalBlock>, else_branch: Option<Vec<Statement>>, }, Case { operand: Option<Expr>, branches: Vec<ConditionalBlock>, else_branch: Option<Vec<Statement>>, }, Loop { label: Option<Ident>, body: Vec<Statement>, }, While { label: Option<Ident>, condition: Expr, body: Vec<Statement>, }, ForIn { label: Option<Ident>, variable: Ident, query: Box<Query>, body: Vec<Statement>, }, Repeat { label: Option<Ident>, body: Vec<Statement>, until: Expr, }, Control { kind: ControlKind, label: Option<Ident>, }, Return, Raise { message: Option<Expr>, }, Call { procedure: ObjectName, args: Vec<Expr>, }, ExecuteImmediate { sql: Expr, into: Vec<Ident>, using: Vec<ExprWithAlias>, }, Assert { condition: Expr, description: Option<Expr>, }, Transaction(TransactionKind), ExportData(Box<ExportData>), LoadData(Box<LoadData>), Raw(String),
}
Expand description

One GoogleSQL statement.

Variants§

§

Query(Box<Query>)

§

CreateTable(Box<CreateTable>)

§

CreateView(Box<CreateView>)

§

CreateFunction(Box<CreateFunction>)

§

CreateTableFunction(Box<CreateTableFunction>)

§

CreateProcedure(Box<CreateProcedure>)

§

CreateSchema(Box<CreateSchema>)

§

Insert(Box<Insert>)

§

Update(Box<Update>)

§

Delete(Box<Delete>)

§

Merge(Box<Merge>)

§

Drop(Box<Drop>)

§

AlterTable(Box<AlterTable>)

§

Truncate

Fields

§

Declare

Fields

§names: Vec<Ident>
§data_type: Option<DataType>
§default: Option<Expr>
§

Set

Fields

§targets: Vec<Expr>
§value: Expr
§

BeginEnd

Fields

§label: Option<Ident>
§exception: Option<Vec<Statement>>
§

If

Fields

§else_branch: Option<Vec<Statement>>
§

Case

Fields

§operand: Option<Expr>
§else_branch: Option<Vec<Statement>>
§

Loop

Fields

§label: Option<Ident>
§

While

Fields

§label: Option<Ident>
§condition: Expr
§

ForIn

Fields

§label: Option<Ident>
§variable: Ident
§query: Box<Query>
§

Repeat

Fields

§label: Option<Ident>
§until: Expr
§

Control

BREAK, LEAVE, CONTINUE, ITERATE with an optional label.

Fields

§label: Option<Ident>
§

Return

§

Raise

Fields

§message: Option<Expr>
§

Call

Fields

§procedure: ObjectName
§args: Vec<Expr>
§

ExecuteImmediate

Fields

§sql: Expr
§into: Vec<Ident>
§

Assert

Fields

§condition: Expr
§description: Option<Expr>
§

Transaction(TransactionKind)

§

ExportData(Box<ExportData>)

§

LoadData(Box<LoadData>)

§

Raw(String)

A statement this parser does not model (GRANT, CREATE MODEL, …), kept as written.

Implementations§

Source§

impl Statement

Source

pub fn walk_exprs(&self, f: impl FnMut(&Expr))

Call f on every expression of the statement, subqueries included.

Source

pub fn walk_selects(&self, f: impl FnMut(&Select))

Call f on every SELECT of the statement.

Source

pub fn contains_dml_or_ddl(&self) -> bool

Whether the statement (or a statement nested in it) is anything other than a query: DML, DDL, scripting, a transaction or an unparsed command.

Source

pub fn referenced_tables(&self) -> Vec<TableName>

The tables the statement reads, without CTE names (see Query::referenced_tables). Written targets are not included.

Source

pub fn query(&self) -> Option<&Query>

The query a statement reads from: the statement itself, the AS query of CREATE or the source of INSERT.

Source

pub fn target_table(&self) -> Option<TableName>

The table a statement writes, if it writes exactly one.

Source§

impl Statement

Source

pub fn visit_tables_mut(&mut self, f: &mut dyn FnMut(&mut TableFactor, bool))

Mutable access to every table reference with whether a CTE in scope binds its name. Written targets (INSERT INTO t, MERGE t) are not table factors and are not visited.

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Self

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<'de> Deserialize<'de> for Statement

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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: &Self) -> bool

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Statement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Statement

Auto Trait Implementations§

§

impl Forget for Statement

§

impl Freeze for Statement
where *const Query is !null: Freeze, PhantomData<Query>: Freeze, *const CreateTable is !null: Freeze, PhantomData<CreateTable>: Freeze, *const CreateView is !null: Freeze, PhantomData<CreateView>: Freeze, *const CreateFunction is !null: Freeze, PhantomData<CreateFunction>: Freeze, *const CreateTableFunction is !null: Freeze, PhantomData<CreateTableFunction>: Freeze, *const CreateProcedure is !null: Freeze, PhantomData<CreateProcedure>: Freeze, *const CreateSchema is !null: Freeze, PhantomData<CreateSchema>: Freeze, *const Insert is !null: Freeze, PhantomData<Insert>: Freeze, *const Update is !null: Freeze, PhantomData<Update>: Freeze, *const Delete is !null: Freeze, PhantomData<Delete>: Freeze, *const Merge is !null: Freeze, PhantomData<Merge>: Freeze, *const Drop is !null: Freeze, PhantomData<Drop>: Freeze, *const AlterTable is !null: Freeze, PhantomData<AlterTable>: Freeze, *const u8 is !null: Freeze, PhantomData<Ident>: Freeze, *const DataType is !null: Freeze, PhantomData<DataType>: Freeze, PhantomData<StructField>: Freeze, PhantomData<u8>: Freeze, *const Expr is !null: Freeze, PhantomData<Expr>: Freeze, PhantomData<CaseWhen>: Freeze, PhantomData<StructExprField>: Freeze, *const Function is !null: Freeze, PhantomData<Function>: Freeze, PhantomData<(Ident, Expr)>: Freeze, PhantomData<Statement>: Freeze, PhantomData<ConditionalBlock>: Freeze, PhantomData<ExprWithAlias>: Freeze, *const ExportData is !null: Freeze, PhantomData<ExportData>: Freeze, *const LoadData is !null: Freeze, PhantomData<LoadData>: Freeze,

§

impl Move for Statement

§

impl RefUnwindSafe for Statement

§

impl Send for Statement
where BoxRaw<Query>: Send, BoxRaw<CreateTable>: Send, BoxRaw<CreateView>: Send, BoxRaw<CreateFunction>: Send, BoxRaw<CreateTableFunction>: Send, BoxRaw<CreateProcedure>: Send, BoxRaw<CreateSchema>: Send, BoxRaw<Insert>: Send, BoxRaw<Update>: Send, BoxRaw<Delete>: Send, BoxRaw<Merge>: Send, BoxRaw<Drop>: Send, BoxRaw<AlterTable>: Send, RawVecInner: Send, BoxRaw<DataType>: Send, BoxRaw<Expr>: Send, BoxRaw<Function>: Send, BoxRaw<ExportData>: Send, BoxRaw<LoadData>: Send,

§

impl Sync for Statement
where BoxRaw<Query>: Sync, BoxRaw<CreateTable>: Sync, BoxRaw<CreateView>: Sync, BoxRaw<CreateFunction>: Sync, BoxRaw<CreateTableFunction>: Sync, BoxRaw<CreateProcedure>: Sync, BoxRaw<CreateSchema>: Sync, BoxRaw<Insert>: Sync, BoxRaw<Update>: Sync, BoxRaw<Delete>: Sync, BoxRaw<Merge>: Sync, BoxRaw<Drop>: Sync, BoxRaw<AlterTable>: Sync, RawVecInner: Sync, BoxRaw<DataType>: Sync, BoxRaw<Expr>: Sync, BoxRaw<Function>: Sync, BoxRaw<ExportData>: Sync, BoxRaw<LoadData>: Sync,

§

impl Unpin for Statement

§

impl UnsafeUnpin for Statement
where *const Query is !null: UnsafeUnpin, PhantomData<Query>: UnsafeUnpin, *const CreateTable is !null: UnsafeUnpin, PhantomData<CreateTable>: UnsafeUnpin, *const CreateView is !null: UnsafeUnpin, PhantomData<CreateView>: UnsafeUnpin, *const CreateFunction is !null: UnsafeUnpin, PhantomData<CreateFunction>: UnsafeUnpin, *const CreateTableFunction is !null: UnsafeUnpin, PhantomData<CreateTableFunction>: UnsafeUnpin, *const CreateProcedure is !null: UnsafeUnpin, PhantomData<CreateProcedure>: UnsafeUnpin, *const CreateSchema is !null: UnsafeUnpin, PhantomData<CreateSchema>: UnsafeUnpin, *const Insert is !null: UnsafeUnpin, PhantomData<Insert>: UnsafeUnpin, *const Update is !null: UnsafeUnpin, PhantomData<Update>: UnsafeUnpin, *const Delete is !null: UnsafeUnpin, PhantomData<Delete>: UnsafeUnpin, *const Merge is !null: UnsafeUnpin, PhantomData<Merge>: UnsafeUnpin, *const Drop is !null: UnsafeUnpin, PhantomData<Drop>: UnsafeUnpin, *const AlterTable is !null: UnsafeUnpin, PhantomData<AlterTable>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Ident>: UnsafeUnpin, *const DataType is !null: UnsafeUnpin, PhantomData<DataType>: UnsafeUnpin, PhantomData<StructField>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const Expr is !null: UnsafeUnpin, PhantomData<Expr>: UnsafeUnpin, PhantomData<CaseWhen>: UnsafeUnpin, PhantomData<StructExprField>: UnsafeUnpin, *const Function is !null: UnsafeUnpin, PhantomData<Function>: UnsafeUnpin, PhantomData<(Ident, Expr)>: UnsafeUnpin, PhantomData<Statement>: UnsafeUnpin, PhantomData<ConditionalBlock>: UnsafeUnpin, PhantomData<ExprWithAlias>: UnsafeUnpin, *const ExportData is !null: UnsafeUnpin, PhantomData<ExportData>: UnsafeUnpin, *const LoadData is !null: UnsafeUnpin, PhantomData<LoadData>: UnsafeUnpin,

§

impl UnwindSafe for Statement
where BoxRaw<Query>: UnwindSafe, BoxRaw<CreateTable>: UnwindSafe, BoxRaw<CreateView>: UnwindSafe, BoxRaw<CreateFunction>: UnwindSafe, BoxRaw<CreateTableFunction>: UnwindSafe, BoxRaw<CreateProcedure>: UnwindSafe, BoxRaw<CreateSchema>: UnwindSafe, BoxRaw<Insert>: UnwindSafe, BoxRaw<Update>: UnwindSafe, BoxRaw<Delete>: UnwindSafe, BoxRaw<Merge>: UnwindSafe, BoxRaw<Drop>: UnwindSafe, BoxRaw<AlterTable>: UnwindSafe, RawVecInner: UnwindSafe, BoxRaw<DataType>: UnwindSafe, BoxRaw<Expr>: UnwindSafe, BoxRaw<Function>: UnwindSafe, BoxRaw<ExportData>: UnwindSafe, BoxRaw<LoadData>: UnwindSafe,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.