[Dbix-class] ROLLBACK seems to be skipped on 0.08

Jesper Krogh jesper at krogh.cc
Thu Oct 18 23:13:50 GMT 2007


There is a change in the behaviour of
$schema->txn_rollback from 0.07* to 0.08*

$ DBIC_TRACE=1 perl -I/tmp/0.07003/lib/ ./test.pl
DBIx::Class version: 0.07003
SELECT "me"."id", "me"."name", "modules"."id", "modules"."name",
"modules"."family_id" FROM "family" "me" LEFT JOIN "module" "modules" ON
( "modules"."family_id" = "me"."id" ) ORDER BY "modules"."family_id":
ROLLBACK

The "rollback" gets into the database.

$ DBIC_TRACE=! perl ./test.pl
DBIx::Class version: 0.08007
SELECT "me"."id", "me"."name", "modules"."id", "modules"."name",
"modules"."family_id" FROM "family" "me" LEFT JOIN "module" "modules" ON
( "modules"."family_id" = "me"."id" ) ORDER BY "modules"."family_id":
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect().

There we get a warning, probably because the $schema->txn_rollback in
the script doesn't get to the database.

The script looks like this.

$ cat test.pl
#!/usr/bin/perl
#
use strict;
use warnings;
use lib "lib/";
use Testdb;
print "DBIx::Class version: " . $DBIx::Class::VERSION . "\n";
my $schema =
Testdb->connect("dbi:Pg:dbname=testdb2","super","super",{AutoCommit => 0});
$schema->txn_begin;
my @all = $schema->resultset("Family")->search({},{prefetch => "modules"});
$schema->txn_rollback;

1;


Jesper
-- 
Jesper Krogh, jesper at krogh.cc




More information about the DBIx-Class mailing list