Re: DataObjects & transactions
| From: | Edward Grace | Date: | Thu, 15 Sep 2005 07:38:33 +0000 |
| Subject: | Re: DataObjects & transactions | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20976@lists.php.net to get a copy of this message | ||
> $do = DB_DataObject::factory('MyFancyTable');
> $do->query("BEGIN");
> // Do anything else from here
>
> On error do:
> $do->query("ROLLBACK");
>
> When all is finished, do:
> $do->query("COMMIT");
Marcus, how does that compare to using:
$db = $do->getDatabaseConnection()
// blah
$db->autoCommit(false)
// blah
$db->rollback()
// blah
$db->commit()
on the underlying DB object? I have encountered quirky behaviour with
transactions and postgres (I'd be willing to bet it's not a problem with
postgres) so if this is somehow "better" i'm eager to know..
-ed