Subject RE: [firebird-support] multiple inserts in trigger
Author Ross Ryding
Thanks for the ideas, I am not trying to insert into table I am testing.
Basically this is an audit of the JOB Header table. I am using a table
called DO_AUDITDTL to post each insert and as such I would not expect any
concurrence errors from the insert. I will test for null, had not thought
that would be an issue but understand safe better than sorry.



_____

From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Helen Borrie
Sent: Wednesday, July 11, 2007 7:31 AM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] multiple inserts in trigger



At 09:52 PM 11/07/2007, you wrote:
>Hello,
>
> Guess I am being slow this morning, why handle NULLS, should they not be
>a miss-compare and thus write a record to the secondary table (audit
table)?

Nope.

if (old.something <> new.something) returns false if one of them is
null. Null isn't a value, it is a state.

>Do not understand infinite recursion to check for. Basically the trigger is
>fired once when the mrp screen moves to another screen.

The trigger is fired once after every update of table XXXX. It isn't
connected to what your user interface is doing at all. If there is no
update, the trigger will never fire. If there is an update, the
trigger will always fire.

>During that time 1
>or more fields could have been changed (I get one trigger for many updates)

...you get all update triggers firing for *each* update...

>at that point I test the fields and update ones that are appropriate. Could
>you please explain in a little more detail.

If your trigger performs an update on the same table that owns the
trigger (bad, bad idea!) you will get infinite recursion. You will
also get a knotty situation if the tables the trigger is updating
have triggers of their own that fire stuff back at table XXXX.

./heLen





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