pub struct CreateTrigger<X: Extension = NoExt> {
pub temporary: Option<TemporaryTableKind>,
pub if_not_exists: bool,
pub name: ObjectName,
pub timing: Option<TriggerTiming>,
pub event: TriggerEvent,
pub table: ObjectName,
pub for_each_row: bool,
pub when: Option<Expr<X>>,
pub body: ThinVec<Statement<X>>,
pub meta: Meta,
}Expand description
A SQLite CREATE [TEMP|TEMPORARY] TRIGGER [IF NOT EXISTS] [<schema> .] <name> [BEFORE | AFTER | INSTEAD OF] <event> ON <table> [FOR EACH ROW] [WHEN <expr>] BEGIN <stmt>; ... END statement (SQLite-specific; gated by
StatementDdlGates::create_trigger).
Unlike the other CREATE families — which are always accepted because their body
grammar is standard — the trigger gate is real: only SQLite’s BEGIN … END
SQL-statement-body form is modelled, and PostgreSQL/MySQL spell an incompatible
body (EXECUTE FUNCTION f() / an external routine), which they genuinely reject
for this form. Gating to SQLite (and Lenient) is therefore behaviour-accurate, not
only a modelling limitation.
The body is a non-empty sequence of INSERT/UPDATE/DELETE/
SELECT statements — a statement list inside a statement (the structurally
heaviest SQLite shape). It reuses the existing Statement nodes rather than
minting trigger-body variants (the node stays generic over X); the
parser gates the body kinds and routes each through the recursion-guarded
statement dispatcher, and the enclosing Statement::CreateTrigger
boxes this payload to keep the enum within its size budget.
Fields§
§temporary: Option<TemporaryTableKind>Optional temporary for this syntax.
if_not_exists: boolWhether the if not exists form was present in the source.
name: ObjectNameName referenced by this syntax.
timing: Option<TriggerTiming>The fire time; None when unwritten (SQLite defaults it to BEFORE, but the
absent form is preserved so it round-trips).
event: TriggerEventWhich DML event fires the trigger; see TriggerEvent.
table: ObjectNameTable referenced by this syntax.
for_each_row: boolWhether FOR EACH ROW was written. SQLite parses (and ignores) it but rejects
FOR EACH STATEMENT, so only the ROW form is modelled as a surface tag.
when: Option<Expr<X>>Optional when for this syntax.
body: ThinVec<Statement<X>>The trigger-body statement list, in source order (always non-empty — SQLite
rejects an empty BEGIN END).
meta: MetaSource location and node identity.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for CreateTrigger<X>
impl<X: Clone + Extension> Clone for CreateTrigger<X>
Source§fn clone(&self) -> CreateTrigger<X>
fn clone(&self) -> CreateTrigger<X>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, X> Deserialize<'de> for CreateTrigger<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for CreateTrigger<X>where
X: Deserialize<'de> + Extension,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<X: Eq + Extension> Eq for CreateTrigger<X>
Source§impl<X: Extension + Render> Render for CreateTrigger<X>
impl<X: Extension + Render> Render for CreateTrigger<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl<X> Serialize for CreateTrigger<X>
impl<X> Serialize for CreateTrigger<X>
Source§impl<X: Extension> Spanned for CreateTrigger<X>
impl<X: Extension> Spanned for CreateTrigger<X>
impl<X: PartialEq + Extension> StructuralPartialEq for CreateTrigger<X>
Auto Trait Implementations§
impl<X> Freeze for CreateTrigger<X>where
X: Freeze,
impl<X> RefUnwindSafe for CreateTrigger<X>where
X: RefUnwindSafe,
impl<X> Send for CreateTrigger<X>where
X: Send,
impl<X> Sync for CreateTrigger<X>where
X: Sync,
impl<X> Unpin for CreateTrigger<X>where
X: Unpin,
impl<X> UnsafeUnpin for CreateTrigger<X>where
X: UnsafeUnpin,
impl<X> UnwindSafe for CreateTrigger<X>where
X: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.