Subject Re: triggers not working
Author Adam
--- In firebird-support@yahoogroups.com, Thomas Steinmaurer <ts@i...>

> > Forgive my ignorance regarding how ibo / delphi datasets work, but if
> > it's a 'before insert' trigger, if I do an query.insert in delphi and
> > then a query.cancel, I presume the trigger won't have fired?
>
> A trigger will fire when you commit the transaction in which the DML
> statement was executed. No COMMIT = the trigger won't fire.
>

Hmmm, that is a bit confusing and potentially misleading.

The triggers will fire at the moment you execute a query. Even if you
eventually rollback, the trigger has fired, but because the stuff the
trigger does occurs within the context of your transaction, if you
rollback, the changes made by the trigger are also rolled back. In
other words, you do not need to commit the transaction the DML
statement is in to fire the trigger (possibly confusing it with events).

Adam