Re: pear::db, INNO DB and transactions

From: Date: Thu, 11 Dec 2003 15:50:48 +0000
Subject: Re: pear::db, INNO DB and transactions
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9475@lists.php.net to get a copy of this message
Maybe the best way to do this (as I'm not sure innodb tables are shown in DESC tbl_name) would be to allow for a define DB_FORCE_TRANSACTIONS which can then be used by the transaction functions in the mysql driver. As per your question concerning transaction functions returning errors on unsupported DB's I think it is programmed that way for transparency purposes (though I agree at *least* a notice should be thrown by the mysql driver). --Joe > this subject has probably been addressed before but i couldn't find it on > MARC: > > some brief testing seems to show transactions called from PEAR::DB are not > respected if the db is MySQL and the table type is INNO DB which supports > transactions. > > calling from DataObject, i used the following code: > > $oUser = & new DataObjects_Usr(); > $db = $oUser->getDatabaseConnection(); > $db->autoCommit(false); > > // update user object > [...] > $successUser = $oUser->update(); > > // update user's contact details > [...] > $successContact = $oContact->update(); > > if (!($successUser && $successContact)) { > $db->rollback(); > Base::raiseError('There was a problem inserting the record', > SGL_ERROR_NOAFFECTEDROWS); > } else { > $db->commit(); > Output::msgSet('details successfully updated'); > Response::redirect('userMgr.php', array('action'=> > 'list')); > } > > however calling transaction related stuff directly in the queries works as > expected: > > $db->query('BEGIN'); > $db->query('COMMIT'); > $db->query('ROLLBACK'); > > interestingly, no errors occur when the code is run on MyISAM tables. So > the > question is, are there plans for the MySQL driver to detect INNO DB tables > and > support them, is there an interest in this? > > cheers > > demian > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy."

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