Subject Re: [firebird-support] Re: Trigger, check whether a cascade or user caused action
Author W O
It seems very good, I can not see any drawback there.

Greetings.

Walter.



On Sat, Jun 1, 2013 at 1:26 AM, thp_pkmi <thp_pkmi@...> wrote:

> **
>
>
>
>
> --- In firebird-support@yahoogroups.com, "firebirdsql" <firebirdsql@...>
> wrote:
> >
> > I have an after update/delete trigger and would like to know if the
> trigger was triggered by a cascade update/delete OR a user. Is this
> possible?
> >
> I posted an almost similar case today, in my case I just want to
> distinguish cascade delete from user/regular delete.
>
> Actually I have a trick to distinguish user update from cascade update. I
> always put an extra field in my table called Sig (or Tag, or whatever..),
> in my application I always increase Sig by 1 on every post update, then in
> the before update trigger I can detect:
>
> if (new.Sig is distinct from old.Sig) then
> ...
>
> and finally at the end of the trigger I restore the Sig:
> new.Sig= old.Sig;
>
> So far it's working fine, I also wonder if there is a minus in this
> mechanism, would somebody please give an advice or review on this ?
>
> Thanks.
>
> Regards,
> Tjioe Hian Pin
>
>
>


[Non-text portions of this message have been removed]