On Wed, 2002-06-05 at 20:36, Sridhar Subba Rao wrote: > Hello, > > We are using perl as middle tier on unix to communicate between VB > and Sybase. > > We want to know how to implement nested transactions using perl. >
Just use explicit transactions as you would in Transact-SQL (optionally using transaction names, or savepoints) For example: $dbh->{AutoCommit} = 0; $dbh->do("insert ..."); $dbh->do("begin tran level2"); # begin nested transaction (called "level2" here) $dbh->do("update some_other_table ..."); $dbh->do("commit tran level2"); $dbh->commit; Of course you'll need to add a bunch of error handling! Note that $dbh->rollback() will not work if AutoCommit is on. If AutoCommit is OFF then $dbh->rollback() will rollback to the outermost transaction. Personally, to avoid confusion I'd leave AutoCommit ON, and use explicit BEGIN TRAN/COMMIT TRAN/ROLLBACK TRAN SQL statements to handle the transactions if you need nested transactions. Michael -- Michael Peppler / [EMAIL PROTECTED] / http://www.mbay.net/~mpeppler [EMAIL PROTECTED] / ZetaTools, Inc / http://www.zetatools.com ZetaTools: Call perl functions as Sybase stored procedures!
signature.asc
Description: This is a digitally signed message part