pub enum Statement {
Show 32 variants
CreateTable(CreateTable),
CreateIndex(CreateIndex),
Insert(InsertStmt),
Select(Box<SelectStmt>),
Update(UpdateStmt),
Delete(DeleteStmt),
Drop(DropStmt),
AlterTable(AlterTableStmt),
CreateView {
name: String,
body: Box<SelectStmt>,
or_replace: bool,
},
CreateSchema {
name: String,
if_not_exists: bool,
},
SetVariable {
name: String,
value: String,
},
ShowVariable {
name: String,
},
Discard {
target: DiscardTarget,
},
Load {
library: String,
},
Explain {
analyze: bool,
verbose: bool,
format: Option<String>,
body: Box<Statement>,
},
Analyze {
table: Option<String>,
},
Truncate {
tables: Vec<String>,
cascade: bool,
},
Transaction(TransactionStmt),
CreateSequence(CreateSequence),
AlterSequence(AlterSequence),
CreateTableAs {
name: String,
if_not_exists: bool,
body: Box<SelectStmt>,
},
Prepare {
name: String,
body: Box<Statement>,
},
Execute {
name: String,
params: Vec<Expr>,
},
Deallocate {
name: Option<String>,
},
Values {
rows: Vec<Vec<Expr>>,
},
CreateForeignServer(CreateForeignServer),
CreateForeignTable(CreateForeignTable),
Merge(MergeStmt),
CreateFunction(Box<CreateFunction>),
DropFunction(DropFunctionStmt),
DoBlock {
language: String,
body: String,
},
Call {
name: String,
args: Vec<Expr>,
},
}Variants§
CreateTable(CreateTable)
CreateIndex(CreateIndex)
Insert(InsertStmt)
Select(Box<SelectStmt>)
SelectStmt is the largest variant by far (CTEs + set-ops + n-ary
expression trees), so we box it to keep the enum’s stack footprint
proportional to the smaller variants.
Update(UpdateStmt)
Delete(DeleteStmt)
Drop(DropStmt)
AlterTable(AlterTableStmt)
CreateView
CREATE [OR REPLACE] VIEW name AS SELECT .... The body is the
underlying SelectStmt; views are materialised lazily on every
reference (no row caching).
CreateSchema
CREATE SCHEMA [IF NOT EXISTS] name. This AST entry records the
command for the engine’s durable schema catalog and namespace
resolver.
SetVariable
SET <name> [TO|=] <value> - runtime parameter assignment.
The engine gives search_path resolution semantics and stores other
parameters in the logical session for subsequent SHOW statements.
ShowVariable
SHOW <variable> - return the runtime parameter as one
(name -> value) row.
Discard
DISCARD [ALL|PLANS|SEQUENCES|TEMP|TEMPORARY] - clear session state.
The engine resets
session vars, prepared statements and sequences. TEMP is rejected
until temporary tables are supported instead of being silently ignored.
Fields
target: DiscardTargetLoad
LOAD 'library' - load a shared library into the session. The
engine embeds its extension surface, so libraries it provides
natively (Apache AGE) load as no-ops and unknown libraries fail
like a missing $libdir file.
Explain
EXPLAIN .... Carries the inner statement so the engine can
emit the planner output.
Analyze
ANALYZE [table]. The engine refreshes per-column statistics
for cardinality estimation; the AST simply records the target.
Truncate
TRUNCATE TABLE t1, t2 .... Wipes the listed tables.
Transaction(TransactionStmt)
BEGIN / COMMIT / ROLLBACK / SAVEPOINT name.
CreateSequence(CreateSequence)
CREATE SEQUENCE name [START n] [INCREMENT n].
AlterSequence(AlterSequence)
ALTER SEQUENCE name [RESTART [WITH n]] [INCREMENT [BY] n] [START [WITH] n].
CreateTableAs
CREATE TABLE name AS SELECT ....
Prepare
PREPARE name AS <inner>.
Execute
EXECUTE name (param1, param2, ...).
Deallocate
DEALLOCATE name | DEALLOCATE ALL. None means ALL.
Values
SELECT * FROM (VALUES ...) [AS alias] – a standalone VALUES
statement (also reachable from a SET-OP body).
CreateForeignServer(CreateForeignServer)
CREATE SERVER name FOREIGN DATA WRAPPER type OPTIONS (...).
CreateForeignTable(CreateForeignTable)
CREATE FOREIGN TABLE name (...) SERVER server OPTIONS (...).
Merge(MergeStmt)
MERGE INTO target USING source ON cond WHEN MATCHED THEN ... WHEN NOT MATCHED THEN .... SQL:2003 conditional UPSERT.
CreateFunction(Box<CreateFunction>)
CREATE [OR REPLACE] FUNCTION | PROCEDURE .... Boxed: the
definition (parameters + body source) dwarfs other variants.
DropFunction(DropFunctionStmt)
DROP FUNCTION | PROCEDURE [IF EXISTS] name[(args)] [, ...].
DoBlock
DO [LANGUAGE lang] $$ ... $$ - anonymous code block.
Call
CALL proc(args) - procedure invocation. OUT / INOUT
parameters shape the result row.
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>,
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
impl UnwindSafe for Statement
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>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more