Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 21320
Status: resolved
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: jre [...] scanlaser.nl
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.43
  • 1.44
  • 1.45
  • 1.45-5.8.4
  • 1.46
  • 1.47
  • 1.48
  • 1.49
  • 1.50
  • 1.51
  • 1.52
Fixed in: (no value)



Subject: DBI::Proxy commit does not turn on AutoCommit
when using DBI::Proxy, calling $dbh->commit does not turn AutoCommit back on, which means that a subsequent call to $dbi->begin_work fails. The following tests can be added to 80proxy.t to show this (copied from 10examp.t) (10 tests). ----- print "begin_work...\n"; Test($dbh->{AutoCommit}); Test(!$dbh->{BegunWork}); Test($dbh->begin_work); Test(!$dbh->{AutoCommit}); Test($dbh->{BegunWork}); $dbh->commit; Test($dbh->{AutoCommit}); Test(!$dbh->{BegunWork}); Test($dbh->begin_work({})); $dbh->rollback; Test($dbh->{AutoCommit}); Test(!$dbh->{BegunWork}); ----- perl 5.8.0 DBI 1.52 Linux RHEL3
Thanks. Umm. Something else is going on here: Adding PrintError=>1 I see: DBD::Proxy::db commit failed: Server returned error: Failed to execute method CallMethod: Can't locate DBI object method "commit" via package "DBD::ExampleP::db" at /home/value/apps/site_perl/RPC/PlServer.pm line 330. but I don't have time to dig deeper.
Subject: Re: [rt.cpan.org #21320] DBI::Proxy commit does not turn on AutoCommit
Date: Mon, 4 Sep 2006 23:36:17 +0100
To: bug-DBI [...] rt.cpan.org
From: "John Escott"<jre [...] scanlaser.nl>
Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=21320 > > > Adding PrintError=>1 I see: DBD::Proxy::db commit failed: Server
returned Show quoted text
> error: Failed to > execute method CallMethod: Can't locate DBI object method "commit" via
package Show quoted text
> "DBD::ExampleP::db" at /home/value/apps/site_perl/RPC/PlServer.pm line
330. Show quoted text
> > but I don't have time to dig deeper.
DBD::ExampleP::db doesn't define commit or rollback and I found that if I add sub connect { return 1; } sub rollback { return 1; } (around line 420 of ExampleP.pm), then the "Can't locate" messages go away, but the "Already in a transaction" error on the second call to begin_work stays. Not sure if this is the correct fix though since if I change the method definitions to include shift->STORE( AutoCommit => 1 ); then all the new tests pass ok (except for the ones that test {BegunWork}, so maybe I should have included a STORE for that too? I don't know enough about who should be doing what here.). So is the fix just to reset AutoCommit and BegunWork in the driver? If so, I'm a bit surprised, since I'm sure that the first time I came across the problem I was using the *same* driver (I think it was ODBC): (a) directly, where commit "did the right thing" and (b) via proxy, where it didn't. I'll see if I can reproduce that (may be a couple of days though). best regards, John.
On Mon Sep 04 18:36:33 2006, jre@scanlaser.nl wrote: Show quoted text
> DBD::ExampleP::db doesn't define commit or rollback and I found that if I > add > > sub connect { return 1; } > sub rollback { return 1; } > > (around line 420 of ExampleP.pm), then the "Can't locate" messages go away,
Which is very odd because DBD::ExampleP::db is a subclass of the DBD::_::db class in which the DBI implements default commit and rollback [kind of - long story]. Show quoted text
> but the "Already in a transaction" error on the second call to > begin_work stays. Not sure if this is the correct fix though since if I > change the method definitions to include shift->STORE( AutoCommit => 1 ); > then all the new tests pass ok (except for the ones that test {BegunWork}, > so maybe I should have included a STORE for that too? I don't know enough > about who should be doing what here.). > > So is the fix just to reset AutoCommit and BegunWork in the driver?
I think the key is to find out why the 'Can't locate method' is happening on the server side. The DBI dispatcher has special code for handing commit/rollback/BegunWork which isnt getting invoked if the methods can't be found. Show quoted text
> If so, I'm a bit surprised, since I'm sure that the first time I came > across the problem I was using the *same* driver (I think it was ODBC): > (a) directly, where commit "did the right thing" and (b) via proxy, where > it didn't. I'll see if I can reproduce that (may be a couple of days > though).
That's worth doing since some of the behaviour we're seeing is probably just a side effect of ExampleP not properly (appearing to) support transactions. Tim.
I believe this is fixed for 1.53.