Skip to main content

ForeignKeyTrigger

Struct ForeignKeyTrigger 

Source
pub struct ForeignKeyTrigger {
    pub is_check: bool,
    pub deferred: bool,
    pub trigger: Option<TriggerInfo>,
    pub fault: Vec<u8>,
    pub self_referencing: bool,
}
Expand description

One trigger a foreign key implies, or the reason there is not one.

Fields§

§is_check: bool

Whether it refuses a write rather than repairing one.

Only a check can be deferred. An action is what the constraint does, and doing it at commit time instead would leave the rows in between visible to the statements that come after.

§deferred: bool

Whether the key it enforces was declared INITIALLY DEFERRED.

§trigger: Option<TriggerInfo>

The trigger, or None when the key cannot be enforced at all.

§fault: Vec<u8>

Why it cannot be, when it cannot.

A key whose parent table is missing, or whose parent columns are not a key of the parent, is legal to declare: SQLite reports it when something writes, not when the schema is read, so that a schema can be loaded in any order. The message is kept here and reported then.

§self_referencing: bool

Whether the key’s child table and its parent table are the same table.

Read by DROP TABLE’s implicit delete (task-1979, F6). That delete removes every row of one table, so a key whose child is that same table cannot be violated once the statement has finished - the rows that would be left pointing at nothing are themselves gone. SQLite reaches the same answer a different way: its immediate foreign keys are a counter checked at the end of the statement, so the violation deleting the first row creates is cancelled by deleting the row that made it.

Trait Implementations§

Source§

impl Clone for ForeignKeyTrigger

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 ForeignKeyTrigger

Source§

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

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

impl Eq for ForeignKeyTrigger

Source§

impl PartialEq for ForeignKeyTrigger

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 ForeignKeyTrigger

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.