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
name: ObjectNameDeclare
Set
BeginEnd
If
Case
Loop
While
ForIn
Repeat
Control
BREAK, LEAVE, CONTINUE, ITERATE with an optional label.
Return
Raise
Call
ExecuteImmediate
Assert
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
impl Statement
Sourcepub fn walk_exprs(&self, f: impl FnMut(&Expr))
pub fn walk_exprs(&self, f: impl FnMut(&Expr))
Call f on every expression of the statement, subqueries included.
Sourcepub fn walk_selects(&self, f: impl FnMut(&Select))
pub fn walk_selects(&self, f: impl FnMut(&Select))
Call f on every SELECT of the statement.
Sourcepub fn contains_dml_or_ddl(&self) -> bool
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.
Sourcepub fn referenced_tables(&self) -> Vec<TableName>
pub fn referenced_tables(&self) -> Vec<TableName>
The tables the statement reads, without CTE names (see Query::referenced_tables).
Written targets are not included.
Sourcepub fn query(&self) -> Option<&Query>
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.
Sourcepub fn target_table(&self) -> Option<TableName>
pub fn target_table(&self) -> Option<TableName>
The table a statement writes, if it writes exactly one.
Source§impl Statement
impl Statement
Sourcepub fn visit_tables_mut(&mut self, f: &mut dyn FnMut(&mut TableFactor, bool))
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<'de> Deserialize<'de> for Statement
impl<'de> Deserialize<'de> for Statement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Statement
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Forget for Statement
impl Freeze for Statementwhere
*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 Statementwhere
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 Statementwhere
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 Statementwhere
Box<Query>: Unpin,
Box<CreateTable>: Unpin,
Box<CreateView>: Unpin,
Box<CreateFunction>: Unpin,
Box<CreateTableFunction>: Unpin,
Box<CreateProcedure>: Unpin,
Box<CreateSchema>: Unpin,
Box<Insert>: Unpin,
Box<Update>: Unpin,
Box<Delete>: Unpin,
Box<Merge>: Unpin,
Box<Drop>: Unpin,
Box<AlterTable>: Unpin,
*const u8 is !null: Unpin,
Box<DataType>: Unpin,
Box<Expr>: Unpin,
Box<Function>: Unpin,
Box<ExportData>: Unpin,
Box<LoadData>: Unpin,
impl UnsafeUnpin for Statementwhere
*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 Statementwhere
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.