Subject | Re: [Firebird-Architect] Autonomous Transaction Routines |
---|---|
Author | Vlad Khorsun |
Post date | 2007-11-10T08:41:41Z |
> Claudio,Agree. If we choose to let users create own transactions in PSQL then
>
> C> set_transaction : SET TRANSACTION tran_opt_list_m
> C> {$$ = make_node (nod_trans, 1, make_list ($3)); }
> C> ;
>
> C> Why can't we extend this command instead of having to learn a different
> C> syntax?
>
> Personally, I did have a look at that and found it not suitable,
> mainly for lack of an END statement. One way to use it would be to
> have it act on whatever [compound] statement comes next, but I don't
> think it's very intuitive.
they must track this transactions lifetime (i.e. call COMMIT or ROLLBACK).
And this may lead to "orphan" PSQL transactions. Also it open possibility
to create more than one autonomous transactions and force us to assign
names for them to correctly call COMMIT or ROLLBACK. We can easy
avoid it using "block" syntax for autonomous transactions. Note that "block"
syntax also allows to have more than one autonomous transactions but
with clear understanding of they scope.
Compare :
SET TRAN ... "tran1"
...
SET TRAN ... "tran2"
...
// in what transaction this statements are executed ?
...
COMMIT TRAN "tran1"
...
// in what transaction this statements are executed ?
...
COMMIT TRAN "tran2"
with
BEGIN AUTONOMOUS
...
BEGIN AUTONOMOUS
...
END
END
Regards,
Vlad