Skip to main content

ForeignKeyInfo

Struct ForeignKeyInfo 

Source
pub struct ForeignKeyInfo {
    pub id: u32,
    pub columns: Vec<u16>,
    pub parent: Vec<u8>,
    pub parent_folded: Vec<u8>,
    pub parent_columns: Vec<Vec<u8>>,
    pub on_delete: ReferentialAction,
    pub on_update: ReferentialAction,
    pub match_clause: Vec<u8>,
    pub deferrable: bool,
    pub initially_deferred: bool,
    pub cyclic: bool,
}
Expand description

One foreign key, from the child table that declares it.

Fields§

§id: u32

The constraint’s position in its table, counting from zero.

PRAGMA foreign_key_list reports it, and it is how a diagnostic names a constraint that was written without a name - which is most of them.

§columns: Vec<u16>

The child columns, in the order they were written.

§parent: Vec<u8>

The parent table’s name as written.

§parent_folded: Vec<u8>

The parent table’s folded name.

§parent_columns: Vec<Vec<u8>>

The parent columns as written, or empty when the clause named none.

Empty means the parent’s primary key, and it stays empty rather than being resolved here: the catalog builds one table at a time and the parent may not have been read yet - or may not exist, which is legal until something writes a row.

§on_delete: ReferentialAction

What happens to the child rows when a parent row is deleted.

§on_update: ReferentialAction

What happens to the child rows when a parent key changes.

§match_clause: Vec<u8>

The MATCH clause as written, which SQLite parses and ignores.

§deferrable: bool

Whether DEFERRABLE was written.

§initially_deferred: bool

Whether INITIALLY DEFERRED was written.

§cyclic: bool

Whether following this key can lead back to the table that declares it.

A tree with ON DELETE CASCADE on its parent column is the everyday case, and it is the one case an action cannot simply be inlined into the statement that fires it: the body would have to appear once per level the data happens to be deep, which is not known when the statement is compiled. A cyclic key’s action is applied by repeating it until nothing changes instead, and this is what says which keys need that.

Implementations§

Source§

impl ForeignKeyInfo

Source

pub fn is_deferred(&self) -> bool

Reports whether the constraint’s checks wait until the transaction commits.

Trait Implementations§

Source§

impl Clone for ForeignKeyInfo

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 ForeignKeyInfo

Source§

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

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

impl Eq for ForeignKeyInfo

Source§

impl PartialEq for ForeignKeyInfo

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 ForeignKeyInfo

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.