Statement

Enum Statement 

Source
pub enum Statement {
Show 14 variants AddColumn(AddColumn), AlterColumn(AlterColumn), AlterTable(AlterTable), CopyTable(CopyTable), CreateIndex(CreateIndex), CreateTable(CreateTable), DropColumn(DropColumn), DropTable(DropTable), DropIndex(DropIndex), Pragma(Pragma), Delete(Delete), Insert(Insert), Query(Query), Update(Update),
}
Expand description

A SQL statement, covering both DDL (schema changes) and DML (data manipulation).

Variants§

§

AddColumn(AddColumn)

Add a column to an existing table.

§

AlterColumn(AlterColumn)

Alter properties of an existing column.

§

AlterTable(AlterTable)

Alter an existing table (e.g. rename).

§

CopyTable(CopyTable)

Copy rows from one table to another.

§

CreateIndex(CreateIndex)

Create an index.

§

CreateTable(CreateTable)

Create a table.

§

DropColumn(DropColumn)

Drop a column from an existing table.

§

DropTable(DropTable)

Drop a table.

§

DropIndex(DropIndex)

Drop an index.

§

Pragma(Pragma)

A SQLite PRAGMA statement.

§

Delete(Delete)

A DELETE statement.

§

Insert(Insert)

An INSERT statement.

§

Query(Query)

A SELECT query.

§

Update(Update)

An UPDATE statement.

Implementations§

Source§

impl Statement

Source

pub fn add_column(column: &Column, capability: &Capability) -> Self

Adds a column to a table.

Source§

impl Statement

Source

pub fn alter_column( column: &Column, changes: AlterColumnChanges, capability: &Capability, ) -> Self

Alters a column.

Source§

impl Statement

Source

pub fn alter_table_rename_to(table: &Table, new_name: &str) -> Self

Renames a table.

Source§

impl Statement

Source

pub fn copy_table( source: Name, target: Name, columns: Vec<(Name, Name)>, ) -> Self

Creates a statement that copies rows from one table to another.

Source§

impl Statement

Source

pub fn create_index(index: &Index) -> Self

Creates a CREATE INDEX statement from a schema [Index].

Source§

impl Statement

Source

pub fn create_table(table: &Table, capability: &Capability) -> Self

Creates a CREATE TABLE statement from a schema [Table].

Source§

impl Statement

Source

pub fn drop_column(column: &Column) -> Self

Drops a column from a table.

This function does not add an IF EXISTS clause.

Source

pub fn drop_column_if_exists(column: &Column) -> Self

Drops a column from a table if it exists.

This function does add an IF EXISTS clause.

Source§

impl Statement

Source

pub fn drop_index(index: &Index) -> Self

Drops an index.

This function does not add an IF EXISTS clause.

Source

pub fn drop_index_if_exists(index: &Index) -> Self

Drops a index if it exists.

This function does add an IF EXISTS clause.

Source§

impl Statement

Source

pub fn drop_table(table: &Table) -> Self

Drops a table.

This function does not add an IF EXISTS clause.

Source

pub fn drop_table_if_exists(table: &Table) -> Self

Drops a table if it exists.

This function does add an IF EXISTS clause.

Source§

impl Statement

Source

pub fn pragma_enable_foreign_keys() -> Self

Sets PRAGMA foreign_keys = ON.

Source

pub fn pragma_disable_foreign_keys() -> Self

Sets PRAGMA foreign_keys = OFF.

Source

pub fn pragma(name: impl Into<String>, value: impl Into<String>) -> Self

Creates a PRAGMA statement with the given name and value.

Source§

impl Statement

Source

pub fn is_update(&self) -> bool

Returns true if this is an Update statement.

Source

pub fn returning_len(&self) -> Option<usize>

Returns the number of returned elements within the statement (if one exists).

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

Returns a duplicate of the value. Read more
1.0.0 · 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 From<AddColumn> for Statement

Source§

fn from(value: AddColumn) -> Self

Converts to this type from the input type.
Source§

impl From<AlterColumn> for Statement

Source§

fn from(value: AlterColumn) -> Self

Converts to this type from the input type.
Source§

impl From<AlterTable> for Statement

Source§

fn from(value: AlterTable) -> Self

Converts to this type from the input type.
Source§

impl From<CopyTable> for Statement

Source§

fn from(value: CopyTable) -> Self

Converts to this type from the input type.
Source§

impl From<CreateIndex> for Statement

Source§

fn from(value: CreateIndex) -> Self

Converts to this type from the input type.
Source§

impl From<CreateTable> for Statement

Source§

fn from(value: CreateTable) -> Self

Converts to this type from the input type.
Source§

impl From<DropColumn> for Statement

Source§

fn from(value: DropColumn) -> Self

Converts to this type from the input type.
Source§

impl From<DropIndex> for Statement

Source§

fn from(value: DropIndex) -> Self

Converts to this type from the input type.
Source§

impl From<DropTable> for Statement

Source§

fn from(value: DropTable) -> Self

Converts to this type from the input type.
Source§

impl From<Pragma> for Statement

Source§

fn from(value: Pragma) -> Self

Converts to this type from the input type.
Source§

impl From<Statement> for Statement

Source§

fn from(value: Statement) -> Self

Converts to this type from the input type.

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