I was in the process of updating the Apache::DBI section of the guide with
the notes from the latest version of this package, and there is a new
section about Transactions. Since I use mysql, it doesn't have
transactions so I cannot it's not absolutely clear to me. For example why
the script should perform a rollback at the end? Isn't it only for the
case where the transaction has failed? Anybody?

Here is the section:

=head3 Transactions

A standard perl script using DBI will automatically perform a rollback
whenever the script exits. In the case of persistent database
connections, the database handle will not be destroyed and hence no
automatic rollback occurs. At a first glance it seems even to be
possible, to handle a transaction over multiple requests. But this
should be avoided, because different requests are handled by different
mod_perl processes and a mod_perl process does not know the state of a
specific transaction which has been started by another mod_perl
process.

In general it is good practice to perform an explicit commit or
rollback at the end of every script.  In order to avoid
inconsistencies in the database in case C<AutoCommit> is I<Off> and
the script finishes without an explicit rollback, the C<Apache::DBI>
module uses a C<PerlCleanupHandler> to issue a rollback at the end of
every request.

Thanks!

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/  


Reply via email to