|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Transactions errors with DBD-Sybase-1.05
Date: Mar 23 2005 8:29PM
On Wed, 2005-03-23 at 14:45, David Barnwell wrote:
> Hi Michael,
>
> Thanks for your mail.
>
> > Why do you call finish() here?
>
> I tried it without the $sth->finish. I now get a similar error with
> DBD-Sybase-1.04, but this time the commit fails rather than the execute, and
> the rollback is successful. To summarise:
>
> with the $sth->finish statement:
> DBD-Sybase-1.04 OK
> DBD-Sybase-1.05 execute fails, rollback fails silently.
>
> without the $sth->finish statement:
> DBD-Sybase-1.04 commit fails, rollback succeeds
If you check the trace you'll see that the commit fails because of an
"attempt to initiate command with results pending" error.
The $sth->finish call shouldn't be called to flush all results as it may
call ct_cancel() (which wouldn't do what you want). Instead you should
use a loop - something like
REDO: {
while(my $r = $sth->fetch) {
;
}
redo REDO if($sth->{syb_more_results});
}
> DBD-Sybase-1.05 execute fails, rollback fails silently
You've found a bug when using AutoCommit when CHAINED transactions
aren't supported/available.
I'll have to look at the code to see what has changed (I suspect that I
moved the execute() call to a different place, so that the BEGIN TRAN
now gets called too late).
Michael
--
Michael Peppler - mpeppler@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
|