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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.