Re: Interbase DB module problems

From: Date: Tue, 22 Jan 2002 00:44:16 +0000
Subject: Re: Interbase DB module problems
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4032@lists.php.net to get a copy of this message
> I am having problems with the DB::ibase module, and I'm wondering if anybody > else has seen the same thing. > > On a perfectly functional DB connection to interbase, if I try to get a > resultset from getAll() with fetchmode set to DB_FETCHMODE_ASSOC something > gets stuck in a loop, and all I get is the following error message, repeated > forever: Does it happens only with getAll()? > Warning: InterBase: request synchronization error in > /home/virtual/pear/DB/ibase.php on line 177 It looks like a database problem, but ... > sample code: > > $q = "select first 5 url, name, tstamp from links where approved='Y' order > by tstamp desc"; > $vars = $db->getAll($q, null, DB_FETCHMODE_ASSOC); FYI, the params for getAll() and getRow() are "switchable", ie: $vars = $db->getAll($q, DB_FETCHMODE_ASSOC); // will work also > I tried a few things, but I can't find what's causing the bug. The only > thing I noticed is, if I remove the cast to array from ibase.php (lines > 176-178) > > if ($fetchmode & DB_FETCHMODE_ASSOC) { > $ar = ibase_fetch_object($result); > } > > instead of > > if ($fetchmode & DB_FETCHMODE_ASSOC) { > $ar = (array)ibase_fetch_object($result); > } > > everything works well, apart from the fact I get stdObjects where I need > hashes. I don't have access to an Interbase for the moment, but perhaps you could try some things, to see if we find the problem. Here are some ideas: 1) if ($fetchmode & DB_FETCHMODE_ASSOC) { $ar = array(); $ar = (array)ibase_fetch_object($result); } 2) if ($fetchmode & DB_FETCHMODE_ASSOC) { $ar = get_object_vars(ibase_fetch_object($result)); } 3) if ($fetchmode & DB_FETCHMODE_ASSOC) { $obj = ibase_fetch_object($result); $ar = (array)$obj; } 4) if ($fetchmode & DB_FETCHMODE_ASSOC) { $obj = ibase_fetch_object($result); if (is_object($obj)) { $ar = (array)$obj; } else { $ar = null; } } Could be great if you could make it working properly. I guess that ASSOC fetch are pretty useful. Thanks, Tomas V.V.Cox ------------------ Idecnet Correo-Web

« previous php.pear.dev (#4032) next »