Subject | SV: [firebird-support] Quick storage for one INTEGER variable on Firebird 1.5 |
---|---|
Author | Svein Erling Tysvær |
Post date | 2010-12-23T11:16:37Z |
If this transaction is launched from a program, then you could have a table DONT_FIRE(DUMMY integer)
and do this within the one transaction you want not to fire the trigger:
INSERT INTO DONT_FIRE(DUMMY) VALUES (1);
<do whatever you want, except commit>
DELETE FROM DONT_FIRE;
COMMIT;
The value in DONT_FIRE will only be visible to the actual transaction since it isn't committed until after it is deleted and your trigger would check this table to see whether it should continue or not.
HTH,
Set
________________________________________
Fra: firebird-support@yahoogroups.com [firebird-support@yahoogroups.com] på vegne av PenWin [penwin@...]
Sendt: 23. desember 2010 09:49
Til: Firebird Support
Emne: [firebird-support] Quick storage for one INTEGER variable on Firebird 1.5
Hi!
Using Firebird 1.5, I need to store one INTEGER variable
(CURRENT_TRANSACTION) somewhere where it will be quickly available
(because I will need to read this variable in a trigger, and I expect
this trigger to be called millions of times in a row). If I used
Firebird 2.0, I would use RDB$SET_CONTEXT and RDB$GET_CONTEXT, but as
those are not available, I have to use other means. Which of these
possibles would be the best? (Note: I will only ever need one instance,
common to all connections)
1) Separate table: SELECT stored_value FROM storage_table
2) Generator: SELECT GEN_ID(stored_value, 0) FROM rdb$database
3) UDF (I am not sure if I can get persistent memory storage with an
UDF, but I could certainly store the desired value in a file)
Or maybe I am approaching the problem from the wrong side completely?
Basically, I need to stop a trigger from executing, but only for one
given transaction; the trigger should fire normally for other transactions.
Thanks,
Pepak
and do this within the one transaction you want not to fire the trigger:
INSERT INTO DONT_FIRE(DUMMY) VALUES (1);
<do whatever you want, except commit>
DELETE FROM DONT_FIRE;
COMMIT;
The value in DONT_FIRE will only be visible to the actual transaction since it isn't committed until after it is deleted and your trigger would check this table to see whether it should continue or not.
HTH,
Set
________________________________________
Fra: firebird-support@yahoogroups.com [firebird-support@yahoogroups.com] på vegne av PenWin [penwin@...]
Sendt: 23. desember 2010 09:49
Til: Firebird Support
Emne: [firebird-support] Quick storage for one INTEGER variable on Firebird 1.5
Hi!
Using Firebird 1.5, I need to store one INTEGER variable
(CURRENT_TRANSACTION) somewhere where it will be quickly available
(because I will need to read this variable in a trigger, and I expect
this trigger to be called millions of times in a row). If I used
Firebird 2.0, I would use RDB$SET_CONTEXT and RDB$GET_CONTEXT, but as
those are not available, I have to use other means. Which of these
possibles would be the best? (Note: I will only ever need one instance,
common to all connections)
1) Separate table: SELECT stored_value FROM storage_table
2) Generator: SELECT GEN_ID(stored_value, 0) FROM rdb$database
3) UDF (I am not sure if I can get persistent memory storage with an
UDF, but I could certainly store the desired value in a file)
Or maybe I am approaching the problem from the wrong side completely?
Basically, I need to stop a trigger from executing, but only for one
given transaction; the trigger should fire normally for other transactions.
Thanks,
Pepak