CC: | k.spice [...] cv-library.co.uk, t.retout [...] cv-library.co.uk |
Subject: | AutoCommit isn't restored after reconnect when starting a transaction |
If the first command on a disconnected handle with auto_reconnect set is a begin_work it will be die like so:
perl -MDBI -e 'my$d=DBI->connect("DBI:mysql:host=xxx","xxx","xxx",{mysql_auto_reconnect=>1});$d->disconnect;$d->begin_work;$d->commit'
DBD::mysql::db begin_work failed: Turning off AutoCommit failed at -e line 1.
However if you do anything else before starting the transaction then all is well:
perl -MDBI -e 'my$d=DBI->connect("DBI:mysql:host=master.db.cv-library.co.uk","root","defiant1764",{mysql_auto_reconnect=>1});$d->disconnect;$d->do("SELECT 1");$d->begin_work;$d->commit'
Tested on perl 5.14.2 with DBD::mysql 4.031