Subject: | Warning issued by DBIx::Class::Loader::mysql with auto commit enabled |
Hi
I'm using DBIx::Class::Loader::mysql (0.09) with auto commit enabled, and get the following warning emitted:
"Issuing rollback() for database handle being DESTROY'd without explicit disconnect() at /usr/lib/perl5/site_perl/5.8.0/DBIx/Class/Loader/Generic.pm line 208."
Looks to me like DBIx::Class::Loader::mysql::_table_info() needs an explicit disconnect before returning, eg:
sub _table_info {
my ( $self, $table ) = @_;
my $dbh = DBI->connect( @{ $self->{_datasource} } ) or croak($DBI::errstr);
# MySQL 4.x doesn't support quoted tables
my $query = "DESCRIBE $table";
my $sth = $dbh->prepare($query) or die("Cannot get table status: $table");
$sth->execute;
my ( @cols, @pri );
while ( my $hash = $sth->fetchrow_hashref ) {
my ($col) = $hash->{Field} =~ /(\w+)/;
push @cols, $col;
push @pri, $col if $hash->{Key} eq "PRI";
}
$dbh->disconnect; #<<<<<<<<< HERE
croak("$table has no primary key") unless @pri;
return ( \@cols, \@pri );
}
Thanks for all the work you guys are doing with DBIx::Class and, more importantly, Catalyst - great stuff!
Cheers,
Richard Evans