Subject | Re: [Firebird-Architect] Autonomous Transaction Routines |
---|---|
Author | Nando Dessena |
Post date | 2007-11-01T16:41:46Z |
Adriano,
I understand the requirements for the autonomous transaction feature.
I am not sure why it should be linked to routines, though. Wouldn't it
be better to allow for BEGIN TRANSACTION, COMMIT and ROLLBACK
statements in PSQL? It will give all advantages of your idea, plus:
a) ability to execute only part of a trigger or SP in an autonomous
transaction;
b) ability to execute an anonymous block in an autonomous transaction
(admittedly not terribly useful, if not to avoid the need to process
COMMIT and ROLLBACK on the client for simple scripts);
c) ability to execute more than one SPs in the same autonomous
transaction, without having to wrap them into a single calling SP.
Maybe, instead of BEGIN TRANSACTION and COMMIT/ROLLBACK (which would
also require a WHEN..DO block for rollback), a more compact syntax
could be invented, such as:
BEGIN AUTONOMOUS TRANSACTION
... code here
END AUTONOMOUS TRANSACTION -- commits.
P.S. I have a fear that this is a feature very easy to misuse, but I guess
Firebird can't do much about that except produce good documentation
that lists the cases in which to use autonomous transactions, and the
cases in which it's better to avoid them.
Ciao
--
Nando Dessena
I understand the requirements for the autonomous transaction feature.
I am not sure why it should be linked to routines, though. Wouldn't it
be better to allow for BEGIN TRANSACTION, COMMIT and ROLLBACK
statements in PSQL? It will give all advantages of your idea, plus:
a) ability to execute only part of a trigger or SP in an autonomous
transaction;
b) ability to execute an anonymous block in an autonomous transaction
(admittedly not terribly useful, if not to avoid the need to process
COMMIT and ROLLBACK on the client for simple scripts);
c) ability to execute more than one SPs in the same autonomous
transaction, without having to wrap them into a single calling SP.
Maybe, instead of BEGIN TRANSACTION and COMMIT/ROLLBACK (which would
also require a WHEN..DO block for rollback), a more compact syntax
could be invented, such as:
BEGIN AUTONOMOUS TRANSACTION
... code here
END AUTONOMOUS TRANSACTION -- commits.
P.S. I have a fear that this is a feature very easy to misuse, but I guess
Firebird can't do much about that except produce good documentation
that lists the cases in which to use autonomous transactions, and the
cases in which it's better to avoid them.
Ciao
--
Nando Dessena