Subject | AW: [firebird-support] About trigger |
---|---|
Author | Nikolaus Kern |
Post date | 2012-02-02T15:02:28Z |
Hi,
Did you consider to use Context Variables inside the transaction or stored
procedure ?
You can set a context variable RDB$SET_CONTEXT ('USER_TRANSACTION',
'UPDATEPARENTDATE', 'NEIN');
And check for it in the trigger. If it exists, do one thing, if it does not
the other.
IF (RDB$GET_CONTEXT ('USER_TRANSACTION', 'UPDATEPARENTDATE') IS NULL) THEN
Niko
Von: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Im Auftrag von Tomasz Tyrakowski
Gesendet: Donnerstag, 02. Februar 2012 15:40
An: firebird-support@yahoogroups.com
Betreff: Re: [firebird-support] About trigger
Hi,
I've pondered on the problem for some time. All I was able to come up
with was to add an extra insert at the end of the batch, with a
"special" value in one of the fields, which would be recognized by the
trigger and would cause it to execute its code (otherwise the trigger
just exists immediately after being fired).
That's not a very elegant solution, though, but better than nothing.
cheers
Tomasz
Did you consider to use Context Variables inside the transaction or stored
procedure ?
You can set a context variable RDB$SET_CONTEXT ('USER_TRANSACTION',
'UPDATEPARENTDATE', 'NEIN');
And check for it in the trigger. If it exists, do one thing, if it does not
the other.
IF (RDB$GET_CONTEXT ('USER_TRANSACTION', 'UPDATEPARENTDATE') IS NULL) THEN
Niko
Von: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Im Auftrag von Tomasz Tyrakowski
Gesendet: Donnerstag, 02. Februar 2012 15:40
An: firebird-support@yahoogroups.com
Betreff: Re: [firebird-support] About trigger
Hi,
I've pondered on the problem for some time. All I was able to come up
with was to add an extra insert at the end of the batch, with a
"special" value in one of the fields, which would be recognized by the
trigger and would cause it to execute its code (otherwise the trigger
just exists immediately after being fired).
That's not a very elegant solution, though, but better than nothing.
cheers
Tomasz
On 2012-02-02 14:05, nathanelrick wrote:
> Hello,
>
> when i execute several insert (or update or delete), is it possible to
create a trigger that will be raise not on each insert/update/delete but at
the end of these "bulk" inserts ? i can off course call the stored procedure
from the program but for good database integrity i prefer that the database
do it itself ... i thing that their is no possibilities to do so but in case
....
>
>
--
__--==============================--__
__--== Tomasz Tyrakowski ==--__
__--== SOL-SYSTEM ==--__
__--== http://www.sol-system.pl ==--__
__--==============================--__
[Non-text portions of this message have been removed]