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

Brandon Black blblack at gmail.com
Thu Oct 18 23:34:32 GMT 2007


On 10/18/07, Jesper Krogh <jesper at krogh.cc> wrote:
> 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;
>
>

The warning message you're seeing doesn't necessarily relate to the
txn_rollback not making it to the database.  It's a general warning
that would happen anytime you don't disconnect immediately before
undefining a $dbh with AutoCommit=>0.  Can you double check your
AutoCommit setting, and can you verify with a few more warning
statements inserted near the bottom around the rollback call, and/or a
final $schema->storage->dbh->disconnect()?

-- Brandon



More information about the DBIx-Class mailing list