Categorized | News

DataObject, INNO DB and transactions

Posted on 15 December 2003 by Demian Turner

If you’re looking 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 the above approach degrades with no issues on myisam tables, coding following the this convention would appear to be a good idea for apps thinking of a postgres upgrade path.

Bookmark and Share

1 Comments For This Post

  1. sunil badola Says:

    Realy good idea got another thing from here to extract the database connection from a dataobject.

Leave a Reply



Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists



PHPkitchen recommends you also check out the following sites :

Accounting for Small Businesses

FreeAgent sign-up