Hi,
thanks to the patches of Bob Lyons (lyons@stripped) I am
glad to announce support for MySQL's transactions in DBD::mysql.
These patches are part of the Msql-Mysql-modules 1.2216. There
are also some minor bug fixes and installation issues, see the
following ChangeLog.
Anyone who starts using the transaction support, should read
the section on TRANSACTION SUPPORT in the docs, which I also
add below. You can recall it at any time with
perldoc DBD::mysql.
Thanks to all of those who sent patches. I apologize for waiting
so long to apply them.
Yours,
Jochen
2001-04-01 Jochen Wiedmann <joe@stripped> (1.2216)
* Added transaction support for MySQL.
(Bob Lyons <lyons@stripped>)
* dbd/dbdimp.c: Fixed MAXLENGTH warning; used to hint for
a not existing mysql_maxlength, which should read
mysql_max_length. (Paul DuBois <paul@stripped>)
* Fixed installation problem when a directory was specified,
but did not exist. (Will Partain <partain@stripped>)
* Fixed that mysql_errno wasn't used properly. (Chris Adams
<cmadams@stripped>)
* Fixed test suite problem, when user name and password
have been interpolated. (Bruno Hivert (LMC)
<lmcbrhi@stripped>)
* mysql_insertid and mysql_affectedrows are no longer treated
as integers, but longs. Thanks to Michael G Schwern
<schwern@stripped>.
TRANSACTION SUPPORT
Beginning with Msql-Mysql-modules 1.2216, transactions are supported
by DBD::mysql. The transaction support works as follows:
* By default AutoCommit mode is on, following the DBI
specifications.
* If you execute
$dbh-E<gt>{'AutoCommit'} = 0;
or
$dbh-E<gt>{'AutoCommit'} = 1;
then the driver will set the MySQL server variable autocommit to
0 or 1, respectively. Switching from 0 to 1 will also issue a
COMMIT, following the DBI specifications.
* The methods
$dbh-E<gt>rollback();
$dbh-E<gt>commit();
will issue the commands COMMIT and ROLLBACK, respectively. A
ROLLBACK will also be issued if AutoCommit mode is off and the
database handles DESTROY method is called. Again, this is
following the DBI specifications.
Given the above, you should note the following:
* You should never change the server variable autocommit manually,
unless you are ignoring DBI's transaction support.
* Switching AutoCommit mode from on to off or vice versa may fail.
You should always check for errors, when changing AutoCommit
mode. The suggested way of doing so is using the DBI flag
RaiseError. If you don't like RaiseError, you have to use code
like the following:
$dbh->{'AutoCommit'} = 0;
if ($dbh->{'AutoCommit'}) {
# An error occurred!
}
* If you detect an error while changing the AutoCommit mode, you
should no longer use the database handle. In other words, you
should disconnect and reconnect again, because the transaction
mode is unpredictable. Alternatively you may verify the
transaction mode by checking the value of the server variable
autocommit. However, such behaviour isn't portable.
| Thread |
|---|
| • Announce: Transaction support for DBD::mysql | Jochen Wiedmann | 7 Apr |