List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:April 7 2001 3:54pm
Subject:Announce: Transaction support for DBD::mysql
View as plain text  

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.



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
        * Fixed test suite problem, when user name and password
          have been interpolated. (Bruno Hivert (LMC)
        * mysql_insertid and mysql_affectedrows are no longer treated
          as integers, but longs. Thanks to Michael G Schwern

        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

        *   If you execute

                $dbh-E<gt>{'AutoCommit'} = 0;


                $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


            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.

Announce: Transaction support for DBD::mysqlJochen Wiedmann7 Apr