Re: pear::db, INNO DB and transactions
| From: | Alan Knowles | Date: | Fri, 19 Dec 2003 06:57:25 +0000 |
| Subject: | Re: pear::db, INNO DB and transactions | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9697@lists.php.net to get a copy of this message | ||
I've just added a short bit to query, so,
$do->query('BEGIN'); will turn off autocommits.
The only snag is that this means it cant be turned back on again.. - I'm not sure if that is a big issue however..
This does mean that overload can be used with Transactions.
the snag with the solution below is that you must turn off overload before including DB/DataObject.php - which is a bit klunky..
Regards
Alan
Demian Turner wrote:
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comIt's a return by refernce on overloaded object issue! - bug in the php4 overload engine. just turn of overload - I'm considering making this the default as it seems to be causing to many problems.that's sorted the problem, thanks. for those interested, by way of a summary of the previous posts to this thread, in order to get db_dataobject and transactions working with mysql and the inno db table type, try the following: 1. define('DB_DATAOBJECT_NO_OVERLOAD', true); // somewhere in your script 2. $oUser = new DataObjects_Usr(); // call your dataobject 3. $dbh = & $oUser->getDatabaseConnection(); // get a db handle, reference essential! 4. $dbh->autocommit(); // set autocommit to false 5. ... your queries ... 6. $dbh->rollback()/$dbh->commit(); // called depending on your logic Seeing as this degrades with no issues on myisam tables, coding following the above convention would appear to be a good idea for apps thinking of a postgres upgrade path. cheers demian