apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler MacDonald <tyl...@ActiveState.com>
Subject Re: [PATCH]: Introduce APR DBD transaction mode
Date Mon, 01 May 2006 19:41:23 GMT
Bojan Smojver <bojan@rexursive.com> wrote:
> Perhaps. However, it would seem that not all databases behave the same
> on error mid-transaction. Compare SQLite3 with PostgreSQL:

	SQLite3's transactions leave a bit to be desired.. and on that note,
be very, very wary of MySQL as well. It allows a transaction to be committed
even if there were errors during the transaction (pasted below), and it also
will AUTOMATICALLY COMMIT A TRANSACTION IF YOU DO A CREATE TABLE. That part
is EVIL, EVIL, EVIL!!!!!!

	(sorry, venting...)

	But yeah. Because of implicit commits in MySQL (see
http://dev.mysql.com/doc/refman/5.1/en/implicit-commit.html), any sort of
tracking of a transaction is pretty much moot under MySQL. This drove me mad
when I was working on DBIx::Transaction
(http://search.cpan.org/~CRAKRJACK/DBIx-Transaction-0.008) and
DBIx::Migration::Directories
(http://search.cpan.org/~CRAKRJACK/DBIx-Migration-Directories-0.05).

	Maybe if MySQL is detected APR should refuse to support
transactions and tell the end user to find a non-broken database engine. :-)

	Cheers,
		Tyler

mysql> begin work;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into foo values (1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into foo values (1);
Query OK, 1 row affected (0.00 sec)

mysql> invert into foo values (1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use
near 'invert into foo values (1)' at line 1
mysql> commit;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from foo;
+------+
| bar  |
+------+
| 1    |
| 1    |
+------+
2 rows in set (0.00 sec)



Mime
View raw message