Subject AW: [firebird-support] Re: About trigger
Author Nikolaus Kern
Hi,



The context variable needs to be done inside Firebird.



Eg. For the batch processing you will create a SP that will do the job.
Inside the SP you can set the context variable.



Niko



Von: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Im Auftrag von nathanelrick
Gesendet: Donnerstag, 02. Februar 2012 16:33
An: firebird-support@yahoogroups.com
Betreff: [firebird-support] Re: About trigger





this could be a good idea, but it's will be too much dependent of the
application (what if developer forget to set this context variable?)

--- In firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com> , "Nikolaus Kern"
<parzival1969@...> wrote:
>
> 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%40yahoogroups.com>
> [mailto:firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.com> ] Im Auftrag von Tomasz
Tyrakowski
> Gesendet: Donnerstag, 02. Februar 2012 15:40
> An: firebird-support@yahoogroups.com
<mailto:firebird-support%40yahoogroups.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]
>





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