Triggersoh that is excellent!!! I'm adding this to mine.
----- Original Message -----
From: Emmitt Dove
To: RBASE-L Mailing List
Sent: Wednesday, August 13, 2008 7:17 PM
Subject: [RBASE-L] - Re: Triggers
John,
Checking in late here . I, too, use a global variable in the trigger to test
if it should execute. I use an integer variable, and at the top of the trigger
code I do:
SET VAR vrrf INTEGER
IF vrrf IS NULL THEN
RETURN 0
ENDIF
This way, only code that wants to bypass the trigger needs to be aware of the
shunt. When performing mass updates or deletes to the table that it would be
useless to audit, this saves a whole lot of time.
Emmitt Dove
Manager, DairyPak Business Systems
Evergreen Packaging, Inc.
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(203) 643-8022
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of John Engwer
Sent: Wednesday, August 13, 2008 7:09 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Triggers
James and Rachael,
I have both before and after triggers. I will probably go with a switch
similar to what Rachael describes.
It would be nice to have a SET TRIGGER XXXXXXXXXXX OFF/ON
John
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Rachael Malberg
Sent: Wednesday, August 13, 2008 4:37 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Triggers
I added this to the start of my triggers....
set var tv_RunTrig text
if tv_RunTrig is null then
set var tv_RunTrig text='Y'
endif
if tv_RunTrig ='Y' then
---run the trigger code
clear var tv_RunTrig
endif
then if I'm doing updates that I don't want the trig to run before updating I
set the var tv_RunTrig='N'
and clear it after I'm done.
----- Original Message -----
From: John Engwer
To: RBASE-L Mailing List
Sent: Wednesday, August 13, 2008 2:57 PM
Subject: [RBASE-L] - Triggers
I use a lot of triggers in my applications and sometimes I would like to
suppress the trigger for certain processes. Such as the audit trigger when
updating a large table. Because I usually perform these procedures at night
when no one else is using the database, I currently drop the trigger when I
start the routine and then add it back at the end of the procedure. It works
fine except that the trigger is then not active for other users that may log
onto the system unexpectedly.
I think that I may program a switch into the procedure to bypass the code
in the trigger procedure but I thought that I would ask how other developers
handle this issue. I tried using the ABORT TRIGGER in the procedure but it did
not suppress the trigger.
Any input will be appreciated.
John