Skip to main content

Directive

Enum Directive 

Source
pub enum Directive {
Show 19 variants Begin(BeginKind), Commit, Rollback { savepoint: Option<Vec<u8>>, }, Savepoint(Vec<u8>), Release(Vec<u8>), CreateTable { if_not_exists: bool, database: usize, name: Vec<u8>, name_offset: u32, exists: bool, }, CreateTableAsSelect { if_not_exists: bool, database: usize, name: Vec<u8>, exists: bool, create_sql: Vec<u8>, select_sql: Vec<u8>, }, CreateVirtualTable { if_not_exists: bool, database: usize, name: Vec<u8>, module: Vec<u8>, arguments: Vec<Vec<u8>>, name_offset: u32, exists: bool, }, Alter { database: usize, table: Vec<u8>, action: AlterKind, }, Reindex { database: usize, indexes: Vec<Vec<u8>>, }, Vacuum { database: usize, into: Option<Vec<u8>>, }, Attach { file: Vec<u8>, schema: Vec<u8>, }, Detach { schema: Vec<u8>, }, Analyze { database: usize, table: Option<Vec<u8>>, every_schema: bool, }, CreateView { if_not_exists: bool, database: usize, name: Vec<u8>, name_offset: u32, exists: bool, }, CreateTrigger { database: usize, name: Vec<u8>, name_offset: u32, table: Vec<u8>, exists: bool, }, CreateIndex { unique: bool, if_not_exists: bool, database: usize, name: Vec<u8>, name_offset: u32, table: Vec<u8>, table_root: u32, using: Option<Vec<u8>>, columns: Vec<IndexKeyColumn>, settings: Vec<(Vec<u8>, Vec<u8>)>, exists: bool, }, Drop { kind: ObjectKind, if_exists: bool, database: usize, name: Vec<u8>, root: u32, index_roots: Vec<u32>, exists: bool, }, Pragma { database: Option<usize>, name: Vec<u8>, argument: Option<PragmaArgument>, },
}
Expand description

A statement the session carries out.

Variants§

§

Begin(BeginKind)

BEGIN.

§

Commit

COMMIT or END.

§

Rollback

ROLLBACK, or ROLLBACK TO savepoint.

Fields

§savepoint: Option<Vec<u8>>

The savepoint to roll back to, when one was named.

§

Savepoint(Vec<u8>)

SAVEPOINT name.

§

Release(Vec<u8>)

RELEASE name.

§

CreateTable

CREATE TABLE.

Fields

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: usize

Which attached database.

§name: Vec<u8>

The table name as written.

§name_offset: u32

The byte the name starts at in the statement’s source.

§exists: bool

Whether the table already exists.

§

CreateTableAsSelect

CREATE TABLE ... AS SELECT.

A CREATE whose column list comes from a plan, which is why it is a directive of its own rather than a flag on the one above: everything about the table - its column names, and the declared types it inherits from the query’s origin columns - is decided by binding the query, and the CREATE text that is stored is synthesised rather than being a slice of what was typed.

Fields

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: usize

Which attached database.

§name: Vec<u8>

The table name as written.

§exists: bool

Whether the table already exists.

§create_sql: Vec<u8>

The CREATE TABLE name(...) text to store, built from the query.

§select_sql: Vec<u8>

The SELECT that fills it, as the source text it was written as.

The text rather than the bound query, because the rows are inserted by an ordinary INSERT INTO name <select> compiled against the schema after the table exists - which is one implementation of what an insert means rather than a second one written here.

§

CreateVirtualTable

CREATE VIRTUAL TABLE.

Fields

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: usize

Which attached database.

§name: Vec<u8>

The table name as written.

§module: Vec<u8>

The module name as written.

§arguments: Vec<Vec<u8>>

The arguments inside the parentheses, as written.

§name_offset: u32

The byte the name starts at in the statement’s source.

§exists: bool

Whether the table already exists.

§

Alter

ALTER TABLE.

Fields

§database: usize

Which attached database.

§table: Vec<u8>

The table being altered, by its stored name.

§action: AlterKind

What to do to it.

§

Reindex

REINDEX, over one index, one table’s indexes, or everything.

Fields

§database: usize

Which attached database.

§indexes: Vec<Vec<u8>>

The indexes to rebuild, by name.

§

Vacuum

VACUUM, which rebuilds the database into a fresh file.

Fields

§database: usize

Which attached database.

§into: Option<Vec<u8>>

The file VACUUM INTO writes the rebuilt copy to.

A string literal, as SQLite’s grammar has it. INTO leaves the database it was run on completely alone, which is the difference between the two forms and the reason the path is carried rather than resolved here.

§

Attach

ATTACH, which adds a database file to this connection.

Fields

§file: Vec<u8>

The file to open, as the literal it was written as.

§schema: Vec<u8>

The name it will be known by.

§

Detach

DETACH, which removes one.

Fields

§schema: Vec<u8>

The name it was attached under.

§

Analyze

ANALYZE, over one object or the whole schema.

Fields

§database: usize

Which attached database.

§table: Option<Vec<u8>>

The one table or index to measure, or nothing for all of them.

§every_schema: bool

Whether the statement was a bare ANALYZE, which measures every database but temp rather than database alone.

§

CreateView

CREATE VIEW.

Fields

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: usize

Which attached database.

§name: Vec<u8>

The view name as written.

§name_offset: u32

The byte the name starts at in the statement’s source.

§exists: bool

Whether the view already exists.

§

CreateTrigger

CREATE TRIGGER.

Fields

§database: usize

Which attached database.

§name: Vec<u8>

The trigger name as written.

§name_offset: u32

The byte the name starts at in the statement’s source.

§table: Vec<u8>

The table or view the trigger is attached to.

§exists: bool

Whether the trigger already exists.

§

CreateIndex

CREATE INDEX.

Fields

§unique: bool

Whether UNIQUE was written.

§if_not_exists: bool

Whether IF NOT EXISTS was written.

§database: usize

Which attached database.

§name: Vec<u8>

The index name as written.

§name_offset: u32

The byte the name starts at in the statement’s source.

§table: Vec<u8>

The table it indexes.

§table_root: u32

The root page of that table.

§using: Option<Vec<u8>>

The module named by USING, folded, when one was.

§columns: Vec<IndexKeyColumn>

The key columns.

§settings: Vec<(Vec<u8>, Vec<u8>)>

The storage parameters WITH ( ... ) named, checked against the module that will read them.

§exists: bool

Whether the index already exists.

§

Drop

DROP TABLE or DROP INDEX.

Fields

§kind: ObjectKind

Which kind of object.

§if_exists: bool

Whether IF EXISTS was written.

§database: usize

Which attached database.

§name: Vec<u8>

The object name.

§root: u32

The root page to free, or zero when the object has none.

§index_roots: Vec<u32>

The root pages of the indexes a DROP TABLE takes with it.

§exists: bool

Whether the object exists.

§

Pragma

PRAGMA.

Fields

§database: Option<usize>

The schema the pragma was qualified with, when one was written.

PRAGMA aux.table_info(t) asks about the attached database rather than about main, and a pragma that dropped the qualifier would answer confidently about the wrong file.

§name: Vec<u8>

The pragma name, folded.

§argument: Option<PragmaArgument>

The argument, when one was written.

Trait Implementations§

Source§

impl Clone for Directive

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 Directive

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Directive

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 Directive

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.