Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: nested transactions / savepoints
Date: Nov 22 2000 7:02PM
Kiriakos Georgiou writes:
> Does anybody know if nested transactions or transaction savepoints are
> supported with DBD-Sybase, and if so how?
> I want to log an error (via an update) before I rollback a whole bunch
> of statements, but if I rollback the whole transaction before logging
> the error, the record won't be locked anymore so there is no guarantee
> that another user won't lock it before I can update it.
As long as the transactions/savepoints are issued on the same physical
connection you should be fine.
It should work both in autocommit mode and with autocommit turned off
(but not if chained transaction mode is turned on, however.)
Assuming you are not using stored procs, something like this should
save tran point_one
... do something
save tran point_two
In general I've used nested transactions in stored procs, where each
create proc ...
save tran foo
... do stuff, possibly calling other procs
rollback tran foo
return error code
Applying the same logic should work perfectly well here too.
Michael Peppler - Data Migrations Inc. - firstname.lastname@example.org
http://www.mbay.net/~mpeppler - email@example.com - AIM MPpplr
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: firstname.lastname@example.org