Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 24 variants Empty, Select(SelectId), Insert(Box<Insert>), Update(Box<Update>), Delete(Box<Delete>), CreateTable { temporary: bool, if_not_exists: bool, database: Option<NameId>, name: NameId, body: CreateTableBody, }, CreateIndex { unique: bool, if_not_exists: bool, database: Option<NameId>, name: NameId, table: NameId, using: Option<NameId>, columns: Vec<IndexedColumn>, settings: Vec<Vec<u8>>, filter: Option<ExprId>, }, CreateView { temporary: bool, if_not_exists: bool, database: Option<NameId>, name: NameId, columns: Vec<NameId>, select: SelectId, }, CreateTrigger { temporary: bool, if_not_exists: bool, database: Option<NameId>, name: NameId, time: Option<TriggerTime>, event: TriggerEvent, table: NameId, for_each_row: bool, when: Option<ExprId>, body: Vec<Statement>, }, CreateVirtualTable { if_not_exists: bool, database: Option<NameId>, name: NameId, module: NameId, arguments: Vec<Vec<u8>>, }, Drop { kind: ObjectKind, if_exists: bool, database: Option<NameId>, name: NameId, }, AlterTable { database: Option<NameId>, table: NameId, action: AlterAction, }, Begin { behaviour: Option<TransactionBehaviour>, }, Commit, Rollback { savepoint: Option<NameId>, }, Savepoint(NameId), Release(NameId), Pragma { database: Option<NameId>, name: NameId, value: PragmaValue, }, Attach { file: ExprId, schema: ExprId, key: Option<ExprId>, }, Detach { schema: ExprId, }, Vacuum { database: Option<NameId>, into: Option<ExprId>, }, Analyze { database: Option<NameId>, name: Option<NameId>, }, Reindex { database: Option<NameId>, name: Option<NameId>, }, Explain { query_plan: bool, inner: Box<Statement>, },
}
Expand description

A parsed statement.

Variants§

§

Empty

An empty statement, which SQLite compiles to nothing.

§

Select(SelectId)

SELECT or VALUES.

§

Insert(Box<Insert>)

INSERT or REPLACE.

§

Update(Box<Update>)

UPDATE.

§

Delete(Box<Delete>)

DELETE.

§

CreateTable

CREATE TABLE.

Fields

§temporary: bool

Whether TEMP was written.

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: Option<NameId>

The schema qualifier.

§name: NameId

The table name.

§body: CreateTableBody

The body.

§

CreateIndex

CREATE INDEX.

Fields

§unique: bool

Whether UNIQUE was written.

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: Option<NameId>

The schema qualifier.

§name: NameId

The index name.

§table: NameId

The table it indexes.

§using: Option<NameId>

The module named by USING, when one was.

SQLite has no USING on CREATE INDEX; PostgreSQL does, and it is how pgvector spells USING hnsw. This engine borrows the spelling for the same purpose: an index whose structure is not a b-tree. A plain CREATE INDEX leaves it None and nothing downstream changes.

§columns: Vec<IndexedColumn>

The key columns.

§settings: Vec<Vec<u8>>

The storage parameters WITH ( ... ) named, as written.

m = 16, ef_construction = 64 and the rest: raw name = value slices, in the order they were written, for the structure named by using to read. Empty for a plain CREATE INDEX, which has no structure to read them.

§filter: Option<ExprId>

The partial-index predicate.

§

CreateView

CREATE VIEW.

Fields

§temporary: bool

Whether TEMP was written.

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: Option<NameId>

The schema qualifier.

§name: NameId

The view name.

§columns: Vec<NameId>

The explicit column list.

§select: SelectId

The query.

§

CreateTrigger

CREATE TRIGGER.

Fields

§temporary: bool

Whether TEMP was written.

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: Option<NameId>

The schema qualifier.

§name: NameId

The trigger name.

§time: Option<TriggerTime>

When it fires.

§event: TriggerEvent

What it fires on.

§table: NameId

The table it is attached to.

§for_each_row: bool

Whether FOR EACH ROW was written.

§when: Option<ExprId>

The WHEN guard.

§body: Vec<Statement>

The body statements, in written order.

§

CreateVirtualTable

CREATE VIRTUAL TABLE.

Fields

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: Option<NameId>

The schema qualifier.

§name: NameId

The table name.

§module: NameId

The module name.

§arguments: Vec<Vec<u8>>

The module arguments, as written source slices.

§

Drop

DROP TABLE|INDEX|VIEW|TRIGGER.

Fields

§kind: ObjectKind

Which kind of object.

§if_exists: bool

Whether IF EXISTS was written.

§database: Option<NameId>

The schema qualifier.

§name: NameId

The object name.

§

AlterTable

ALTER TABLE.

Fields

§database: Option<NameId>

The schema qualifier.

§table: NameId

The table name.

§action: AlterAction

What to do to it.

§

Begin

BEGIN.

Fields

§behaviour: Option<TransactionBehaviour>

DEFERRED, IMMEDIATE or EXCLUSIVE, when written.

§

Commit

COMMIT or END.

§

Rollback

ROLLBACK [TO savepoint].

Fields

§savepoint: Option<NameId>

The savepoint to roll back to.

§

Savepoint(NameId)

SAVEPOINT name.

§

Release(NameId)

RELEASE [SAVEPOINT] name.

§

Pragma

PRAGMA.

Fields

§database: Option<NameId>

The schema qualifier.

§name: NameId

The pragma name.

§value: PragmaValue

The argument.

§

Attach

ATTACH.

Fields

§file: ExprId

The file expression.

§schema: ExprId

The schema name expression.

§key: Option<ExprId>

The KEY expression.

§

Detach

DETACH.

Fields

§schema: ExprId

The schema name expression.

§

Vacuum

VACUUM.

Fields

§database: Option<NameId>

The schema to vacuum.

§into: Option<ExprId>

The INTO target.

§

Analyze

ANALYZE.

Fields

§database: Option<NameId>

The schema qualifier.

§name: Option<NameId>

The object to analyze.

§

Reindex

REINDEX.

Fields

§database: Option<NameId>

The schema qualifier.

§name: Option<NameId>

The collation, table or index to reindex.

§

Explain

EXPLAIN or EXPLAIN QUERY PLAN.

Fields

§query_plan: bool

Whether QUERY PLAN was written.

§inner: Box<Statement>

The statement being explained.

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 Eq for Statement

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 StructuralPartialEq for Statement

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