While working on my site tonight I put in some transactions just to play around with it. Now I have a mixed set of tables in my MySQL database. Some are regular MyISAM tables and some are InnoDB tables, which have the transaction abilities. Now when AutoCommit is set to 0 on the connection to the database. The transaction tables work great. However I come up with an error when a non-transaction table is worked on.
DBD::mysql::db rollback failed: Warning: Some non-transactional chang
+ed tables couldn't be rolled back at /usr/lib/perl5/site_perl/5.6.1/A
+pache/DBI.pm line 153.
now since
Apache::DBI basically overloads
DBI to create a connection pool. Here is the code around line 153 on Apache::DBI.
# The PerlCleanupHandler is supposed to initiate a rollback after the
+script has finished if AutoCommit is off.
# Note: the PerlCleanupHandler runs after the response has been sent t
+o the client
sub cleanup {
my $prefix = "$$ Apache::DBI ";
print STDERR "$prefix PerlCleanupHandler \n" if $Apache::DBI::DEBU
+G > 1;
my $dbh = $Connected{$Idx};
if ($Rollback{$Idx} and $dbh and $dbh->{Active} and !$dbh->{AutoCo
+mmit} and eval {$dbh->rollback}) {
print STDERR "$prefix PerlCleanupHandler rollback for $Idx \n"
+ if $Apache::DBI::DEBUG > 1;
}
delete $Rollback{$Idx};
1;
}
line 153 has
eval {$dbh->rollback} which executes whenever AutoCommit is set to 0. Isn't DBI supposed to be told by MySQL whether the table is a transaction based table or not? I've gotten around the warning by setting
$dbi->{AutoCommit} to 1 in the non-transaction section of the code that communicates with the DB. However I believe that this is a kludgy way of doing it and it should be handled in DBI somewhere/somehow. In any case, I thought MySQL sets AutoCommit according to the table being accesed by type. Could this be a bug in Apache::DBI or Apache::DBI breaking something on DBI?
BMaximus