Re: Transactions in MD2
| From: | Florian Schmitz | Date: | Sat, 19 May 2007 11:28:54 +0000 |
| Subject: | Re: Transactions in MD2 | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-27325@lists.php.net to get a copy of this message | ||
Thanks for your reply.
I think that a better piece of code would be something like: $mdb2->beginTransaction(); $result = $mdb2->query($sql); if (PEAR::isError($result)) { $mdb2->rollback(); // Handle error in application. return; } [snip] $mdb2->commit();That was exactly what I had in mind and wanted to avoid, because it horribly increases the number of lines of code, without adding any new functionality. It would be fine if I could tell MDB2 to call the error handler of my application, then this one could do the rollback. So far I've only found the debug_handler setting, but this seems to be useful for query rewriting rather.
Of course, I have no idea what application you are writing, and it sounds to be fairly large,The application is this one: http://flyspray.org/ Regards, Florian