Result Set Destroyed Prematurely

From: Date: Tue, 29 Jun 2004 02:40:48 +0000
Subject: Result Set Destroyed Prematurely
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13391@lists.php.net to get a copy of this message
I'm looping through a result set as follows: $res = $d->query($select); if (DB::isError($res)) { throw new DBException(DB_QUERY_ERR, $res->getCode(), $res); } while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) $requests[] = Request::getInstance($row['ID']); The result set has 18 rows and therefore I'd expect 18 iterations through the while loop. However, using the written code I'm only getting one iteration and then the loop breaks. I've isolated the problem to the fact that the static method getInstance() also creates a database connection (to the same database), does a select, builds an object, disconnects from the DB then returns the object. If I comment out the disconnect call in getInstance() then the loop goes around 18 times as expected. So the problem appears to be that disconnecting one database connection invalidates/kills the result set of another database connection. From what I can tell, each call to DB::connect() is returning a new, unique object so I'm not sure why the result set from one connection is being killed when another connection is disconnected. Am I using something incorrectly with PEAR DB? PHP5RC3 with latest PEAR DB installed on Linux. Help appreciated, Derek

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