Skip to main content

Statement

Enum Statement 

Source
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).

Fields

§name: String
§or_replace: bool
§

CreateSchema

CREATE SCHEMA [IF NOT EXISTS] name. This AST entry records the command for the engine’s durable schema catalog and namespace resolver.

Fields

§name: String
§if_not_exists: bool
§

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.

Fields

§name: String
§value: String
§

ShowVariable

SHOW <variable> - return the runtime parameter as one (name -> value) row.

Fields

§name: String
§

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

§

Load

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.

Fields

§library: String
§

Explain

EXPLAIN .... Carries the inner statement so the engine can emit the planner output.

Fields

§analyze: bool
§verbose: bool
§format: Option<String>
§

Analyze

ANALYZE [table]. The engine refreshes per-column statistics for cardinality estimation; the AST simply records the target.

Fields

§

Truncate

TRUNCATE TABLE t1, t2 .... Wipes the listed tables.

Fields

§tables: Vec<String>
§cascade: bool
§

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 ....

Fields

§name: String
§if_not_exists: bool
§

Prepare

PREPARE name AS <inner>.

Fields

§name: String
§

Execute

EXECUTE name (param1, param2, ...).

Fields

§name: String
§params: Vec<Expr>
§

Deallocate

DEALLOCATE name | DEALLOCATE ALL. None means ALL.

Fields

§

Values

SELECT * FROM (VALUES ...) [AS alias] – a standalone VALUES statement (also reachable from a SET-OP body).

Fields

§rows: Vec<Vec<Expr>>
§

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.

Fields

§language: String
§body: String
§

Call

CALL proc(args) - procedure invocation. OUT / INOUT parameters shape the result row.

Fields

§name: String
§args: Vec<Expr>

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

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

Auto Trait Implementations§

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<T> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.