DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

DBD::mysql doesn't follow DBI's documented begin_work / AutoCommit behaviour [rt.cpan.org #15803]

Open mbeijen opened this issue 8 years ago • 0 comments
trafficstars

Migrated from rt.cpan.org#15803 (status was 'open')

Requestors:

From [email protected] on 2005-11-15 03:45:04:

DBD::mysql does not follow the DBI specification for AutoCommit behaviour. According to the documentation for the "begin_work" method:

--snip--
     $rc  = $dbh->begin_work   or die $dbh->errstr;

   Enable transactions (by turning "AutoCommit" off) until the next
   call to "commit" or "rollback". After the next "commit" or "roll-
   back", "AutoCommit" will automatically be turned on again.

   If "AutoCommit" is already off when "begin_work" is called then it
   does nothing except return an error. If the driver does not support
   transactions then when "begin_work" attempts to set "AutoCommit"
   off the driver will trigger a fatal error.
--snip--

I have a database handle with AutoCommit turned on. However, even after issuing a "begin_work" statement, I get these warnings:

commit ineffective with AutoCommit enabled at migrate-database-schema line 96.
Commmit ineffective while AutoCommit is on at migrate-database-schema line 96.

It is also odd that I received two warnings for this same error.

From [email protected] on 2005-11-15 03:49:35:

I should also note that other transactions are started and finished on
the same database handle inside of the "begin_work ... commit" block.
Could this be causing it? Using DBD::Pg, everything seems to work fine
with sub-transactions.


From [email protected] on 2006-12-29 03:07:14:

MySQL doesn't support sub-transactions.

From [email protected] on 2006-12-29 03:21:50:

Jim,
	Subtransactions aren't the only oddity in this bug. The issue is
that I can not have "AutoCommit" turned on, switch it off temporarily, and
do my own begin_work/commit's.

	Pg's subtransaction support is lacking too, that's why I wrote this:

	http://search.cpan.org/~crakrjack/DBIx-Transaction-0.008/

	Please reopen this bug and have a look at at fixing it :)

	Thanks!!!

		- Tyler


Jim Winstead via RT <[email protected]> wrote:
> 
> <URL: http://rt.cpan.org/Ticket/Display.html?id=15803 >
> 
> MySQL doesn't support sub-transactions.
> 

-- 

mbeijen avatar Nov 14 '17 19:11 mbeijen