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: u32The 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: ReferentialActionWhat happens to the child rows when a parent row is deleted.
on_update: ReferentialActionWhat 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: boolWhether DEFERRABLE was written.
initially_deferred: boolWhether INITIALLY DEFERRED was written.
cyclic: boolWhether 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
impl ForeignKeyInfo
Sourcepub fn is_deferred(&self) -> bool
pub fn is_deferred(&self) -> bool
Reports whether the constraint’s checks wait until the transaction commits.