| Florian Schmitz 2007-05-18, 8:00 am |
| Hi.
I intend to switch from ADOdb to MDB2, primarily because the XML
features appear to be better thought out in MDB2. Now before doing
this rather tedious work, I'd like to clarify any uncertainties.
Currently, I don't see how transactions would work for me. In ADOdb
it's basically like this:
$conn->StartTrans();
$conn->Execute($sql);
$conn->Execute($Sql2);
$conn->CompleteTrans();
So I start a transactions, execute any commands and at the end check
whether or not something failed and I have to do a rollback.
According to the manual, in MDB2 it works like this:
$mdb2->beginTransaction();
$mdb2->query($sql);
$mdb2->query($Sql2);
[...]
// determine if the commit or rollback
if ($error_condition) {
$res = $mdb2->rollback();
} else {
$res = $mdb2->commit();
}
Interestingly, the manual doesn't mention the most important point,
that is, how to determine $error_condition and thus decide whether or
not to rollback the changes. The only method I could think of is
checking every single query manually for an error, but I certainly
won't do this for obvious reasons (bloat, work, error prone, ...).
Can anyone enlighten me concerning this issue?
Regards,
Florian
|