Re: DataObjects & transactions

From: Date: Thu, 15 Sep 2005 08:27:37 +0000
Subject: Re: DataObjects & transactions
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20977@lists.php.net to get a copy of this message
Edward Grace schrieb:
$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..
AFAIK, there is no difference, as DataObject calls exactly these methods when encountering a keyword query like the ones I mentioned before. I'm working with Postgres as well and haven't had any problem (at least not with transactions ;-)). CU Markus

« previous php.pear.general (#20977) next »