This sounds like it must be a FAQ, but I can't find it...

Is there any way to prevent the following from warning "Issuing
rollback() for database handle being DESTROY'd without explicit
disconnect()."?

    use DBI;

    my $dbh = DBI->connect('dbi:Pg:dbname=...', undef, undef,
                    { RaiseError => 1, AutoCommit => 0 });
    $dbh->commit();

Without of course giving up the warning when a handle is destroyed with
a transaction still active.  It's really annoying having to micro-manage
the $dbh lifetime just in order to issue a useless ->disconnect().  But
currently, one must do that to avoid a stream of false warnings, in the
midst of which an important warning will be overlooked.

Does DBI not know that the handle is clean?  I looked at the tests in
the code before this warning is issued, but the macros are daunting.
:-)

I'm using DBI 1.40 and DBD::Pg 1.31 on Debian "testing".

Andrew

Reply via email to