Skip to main content

BoundTrigger

Struct BoundTrigger 

Source
pub struct BoundTrigger {
    pub name: Vec<u8>,
    pub table: Vec<u8>,
    pub time: TriggerTime,
    pub when: Option<BoundExpr>,
    pub body: Vec<BoundTriggerStatement>,
    pub foreign_key: bool,
    pub self_referencing: bool,
}
Expand description

A trigger, bound against the write that fires it.

It is bound per statement rather than once per schema because the body’s FROM terms take statement-wide source numbers, and those only exist relative to the statement they are inlined into.

Fields§

§name: Vec<u8>

The trigger’s name, for the diagnostic when its body fails.

§table: Vec<u8>

The folded name of the table it is attached to.

Read by the executor to decide whether a body statement is writing the trigger’s own table, which is what PRAGMA recursive_triggers is about: with it on, such a write fires this trigger again.

§time: TriggerTime

Whether it fires before or after the row is written.

§when: Option<BoundExpr>

The WHEN guard, when one was written.

§body: Vec<BoundTriggerStatement>

The body statements, in written order.

§foreign_key: bool

Whether the binder synthesised this from a REFERENCES clause rather than reading it from a CREATE TRIGGER.

Read by DROP TABLE (task-1979, F6). Dropping a table with foreign keys on runs an implicit DELETE FROM first, so the keys that reference it are enforced - and SQLite’s rule is that the implicit delete fires no triggers of its own while still performing every foreign key action. A delete bound for that purpose keeps the triggers this flag marks and drops the rest.

§self_referencing: bool

Whether the foreign key this enforces has one table as both its child and its parent.

Also read by DROP TABLE (task-1979, F6). The implicit delete keeps the foreign key triggers and drops this one, because emptying a table cannot leave a row of that same table pointing at nothing - see ForeignKeyTrigger::self_referencing, which is where the value comes from. Always false on a trigger the schema wrote.

Trait Implementations§

Source§

impl Clone for BoundTrigger

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 BoundTrigger

Source§

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

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

impl PartialEq for BoundTrigger

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 BoundTrigger

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.