Re: MDB transactions in pgsql driver
| From: | Jeroen Houben | Date: | Wed, 28 May 2003 10:04:51 +0000 |
| Subject: | Re: MDB transactions in pgsql driver | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16768@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
<?php include 'MDB.php'; $db = &MDB::connect(DSN); //$db->captureDebugOutput(TRUE); $db->setFetchMode(MDB_FETCHMODE_ASSOC); $groups = $db->getAssoc('SELECT group_id, name FROM groups'); foreach ($groups as $group_id => $groupname) { $query = 'SELECT perm FROM permissions WHERE section_id='.$db->getIntegerValue($section_id).' AND group_id='.$db->getIntegerValue($group_id); $perms = $db->queryOne($query); $defaults["perm[$group_id]"] = empty($perms) ? 'NONE' : trim($perms); $radio = array(); unset($radio); } ?>From: Jeroen Houben [mailto:jeroen@terena.nl] Sent: Wednesday, May 28, 2003 10:43 AMandOk I hope I solved the issue. Your hint with in_transaction not being set was correct. Try and see if things work now. I don't have time to check myself atm :-/I replaced the stable pgsql.php and common.php with the CVS versionsnow I get other errors not related to the replace method. Notice: Undefined index: Coordinators in /usr/local/share/php/pear/MDB/pgsql.php on line 1267 Warning: pg_numrows(): supplied argument is not a valid PostgreSQL result resource in /usr/local/share/php/pear/MDB/pgsql.php on line 799 Warning: pg_freeresult(): supplied argument is not a valid PostgreSQL result resource in /usr/local/share/php/pear/MDB/pgsql.php on line 823Hmm ok these errors happen when you pass an already free result to one of the fetch methods. Could you try to pin point the exact location in your code. I don't know, it was working before. It's simple stuff I'm trying to do. I've simplyfied the code to make it easier to debug.
Also remember that all [get|query|fetch][one|row|col|all] methods free the result .. ALWAYS! This is not properly documented. So calling $arr = $mdb->fetchRow($result); will fetch a single row and then free the result set. I am aware of the fact that this is confusing users and I will address it with a new major release that will happen end if june early july. I'll dive into the code, see if it's easy to fix.One small bug I came across in Common.php
line 255: var $fetchmode = DB_FETCHMODE_ORDERED; should be MDB_FETCHMODE_ORDERED;Cheers Jeroen