pub struct CreateStoredTrigger<X: Extension = NoExt> {
pub definer: Option<Box<Definer>>,
pub if_not_exists: bool,
pub name: ObjectName,
pub timing: TriggerTiming,
pub event: TriggerEvent,
pub table: ObjectName,
pub ordering: Option<TriggerOrder>,
pub body: Box<Statement<X>>,
pub meta: Meta,
}Expand description
CREATE [DEFINER = <user>] TRIGGER [IF NOT EXISTS] <name> {BEFORE | AFTER} {INSERT | UPDATE | DELETE} ON <table> FOR EACH ROW [{FOLLOWS | PRECEDES} <other>] <sp_proc_stmt> — the MySQL SQL/PSM trigger (gated by
StatementDdlGates::compound_statements,
the same stored-program gate the routine wrappers ride).
A DISTINCT node from the SQLite CreateTrigger, not an extension of it, because the two
shapes do not genuinely unify — the decisive split is the body: SQLite’s is a
BEGIN <stmt>; … END list of plain SQL statements (CreateTrigger::body, a
ThinVec), MySQL’s is a single sp_proc_stmt — usually a
Statement::Compound block, but any one body statement (a SET,
a flow-control construct) — parsed through the shared parse_body_statement seam and boxed
because Statement is large. Their decorating axes are disjoint too: SQLite carries
TEMP / WHEN / INSTEAD OF / UPDATE OF <cols>, MySQL carries DEFINER,
mandatory BEFORE/AFTER timing, mandatory FOR EACH ROW, and the
FOLLOWS/PRECEDES ordering anchor. Folding both into one node would
leave half its fields dialect-dead — the CreateProcedure precedent (a MySQL
stored-program object gets its own node rather than overloading a cross-dialect one) applies.
The timing and event axes reuse the shared
TriggerTiming / TriggerEvent vocabulary — MySQL simply never emits the SQLite-only
TriggerTiming::InsteadOf or a non-empty TriggerEvent::Update column list (the parser
enforces the bare forms), so the reuse is safe and keeps one trigger-axis vocabulary.
Fields§
§definer: Option<Box<Definer>>The optional DEFINER = <user> account prefix; None when omitted. Boxed (the rare
fat field pays only a null pointer when absent), like CreateProcedure::definer.
if_not_exists: boolWhether the IF NOT EXISTS guard was written (MySQL 8.0.29+).
name: ObjectNameName referenced by this syntax.
timing: TriggerTimingThe fire time (BEFORE / AFTER) — mandatory in MySQL (no defaulted/absent form, and
never TriggerTiming::InsteadOf).
event: TriggerEventThe DML event that fires the trigger (INSERT / UPDATE / DELETE) — always the bare
form; MySQL has no UPDATE OF <cols>, so a TriggerEvent::Update carries no columns.
table: ObjectNameTable referenced by this syntax.
ordering: Option<TriggerOrder>The optional {FOLLOWS | PRECEDES} <other> ordering anchor relative to another trigger on
the same table and event; None for the unordered form.
body: Box<Statement<X>>The trigger body: one sp_proc_stmt, boxed. Usually a
Statement::Compound BEGIN … END block, but any single
body statement is admitted, parsed through the parse_body_statement seam.
meta: MetaSource location and node identity.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for CreateStoredTrigger<X>
impl<X: Clone + Extension> Clone for CreateStoredTrigger<X>
Source§fn clone(&self) -> CreateStoredTrigger<X>
fn clone(&self) -> CreateStoredTrigger<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 CreateStoredTrigger<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for CreateStoredTrigger<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 CreateStoredTrigger<X>
Source§impl<X: Extension + Render> Render for CreateStoredTrigger<X>
impl<X: Extension + Render> Render for CreateStoredTrigger<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 CreateStoredTrigger<X>
impl<X> Serialize for CreateStoredTrigger<X>
Source§impl<X: Extension> Spanned for CreateStoredTrigger<X>
impl<X: Extension> Spanned for CreateStoredTrigger<X>
impl<X: PartialEq + Extension> StructuralPartialEq for CreateStoredTrigger<X>
Auto Trait Implementations§
impl<X> Freeze for CreateStoredTrigger<X>
impl<X> RefUnwindSafe for CreateStoredTrigger<X>where
X: RefUnwindSafe,
impl<X> Send for CreateStoredTrigger<X>where
X: Send,
impl<X> Sync for CreateStoredTrigger<X>where
X: Sync,
impl<X> Unpin for CreateStoredTrigger<X>
impl<X> UnsafeUnpin for CreateStoredTrigger<X>
impl<X> UnwindSafe for CreateStoredTrigger<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.