[wp-hackers] Implementing databse transaction in Wordpress

Jacob Santos wordpress at santosj.name
Mon Oct 4 15:24:11 UTC 2010


The MySQL extension does not support transactions, you would either have to:

1. Implement a poor man's transaction support into wpdb by executing the SQL
to start the transaction and stop the transaction manually, which may not
always work and may trigger an error if the table does not support
transactions and the server is not configured to ignore if not supported for
table type.

2. Switch to the mysqli extension (this is fairly simple process, just
change mysql_ to mysqli_ and modify for few differences, where required).
The mysqli extensions handles whether or not transactions are required, so
if the table type does not support transactions, it won't blow up in your
face.

3. Switch to PDO, which is a more involved rewrite of the wpdb class.


On Sat, Oct 2, 2010 at 9:55 AM, Chris Klosowski <chris at chriskdesigns.com>wrote:

> I make it standard practice to run repairs on my data bases via a cron...


I take the prayer approach. I pray every that my data integrity is intact
and so far it has been working perfectly. I have no reason to believe that
prayer won't continue to work in the future. There was that one time... but
that probably the fault of something evil instead.

Jacob Santos


More information about the wp-hackers mailing list