Category: MySQL
MDB2 transaction bug
2007/11/12 @ 11:52There is currently a bug in the current stable release of MDB2 (2.4.1) that breaks transaction support with MySQL databases. It seems to occur anytime the server cababilities are checked twice (This basically means that it occurs when creating multiple connections to the database).
After running into this bug I took a dive into the code for MDB2 and found that was caused by the use of a static variable that is used to determine if the capabilites were already checked or not, including whether transactions are supported or not. Basically you make one connection to the database and everything is fine, it checks the capabilities and finds that transactions are supported and sets a class member variable indicating this. However, when making the second connection, the server capabilities are checked in the new object. The member variable of the new object that specifies if transactions are supported defaults to false, but the function that actually checks the capabilities checks the static variable to see if they were already checked and skips checking again leaving the new connection object with transaction support set to false.
Seems like a silly oversight to me, but one that caused me a headache for a couple hours. I looked to see if I needed to submit a bug report and/or patch but it seems that someone has already done so. The change should be in the next stable version but I need to patch my currently running servers so that transaction support is enabled in the mean time.









