pub struct TriggerInfo {
pub name: Vec<u8>,
pub folded: Vec<u8>,
pub time: TriggerTime,
pub event: TriggerEventInfo,
pub ast: Ast,
pub when: Option<ExprId>,
pub body: Vec<Statement>,
pub table_database: Option<Vec<u8>>,
}Expand description
A trigger’s parsed definition.
Kept parsed here for the same reason a view body is: the arena belongs to the catalog snapshot, which the binder holds for the whole statement, so a body can be bound in place. A body re-parsed inside the binder would be a local whose borrow ends before the bound tree does.
Fields§
§name: Vec<u8>The trigger name as declared.
folded: Vec<u8>The ASCII-folded lookup key.
time: TriggerTimeWhen it fires. CREATE TRIGGER with no time written means BEFORE.
event: TriggerEventInfoWhat it fires on.
ast: AstThe arena the WHEN guard and the body were parsed into.
when: Option<ExprId>The WHEN guard, when one was written.
body: Vec<Statement>The body statements, in written order.
table_database: Option<Vec<u8>>The folded database the ON clause named, as in ON main.t, when it
named one.
Implementations§
Source§impl TriggerInfo
impl TriggerInfo
Sourcepub fn fires_for(&self, event: &TriggerEventInfo, changed: &[Vec<u8>]) -> bool
pub fn fires_for(&self, event: &TriggerEventInfo, changed: &[Vec<u8>]) -> bool
Returns whether this trigger fires for one event on one column set.
changed is the folded names an UPDATE assigns, and is empty for the
other two events. UPDATE OF a, b fires only when the statement writes
a or b - which SQLite decides from the statement, not from whether
the value actually differs.