Re: DB.php bug with oci8
| From: | Tomas V.V.Cox | Date: | Tue, 27 Mar 2001 17:18:23 +0000 |
| Subject: | Re: DB.php bug with oci8 | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-116@lists.php.net to get a copy of this message | ||
Paul Rees wrote:
>
> Hi all,
>
> The fetchRow() function in the latest DB.php (1.54) is broken with my
> Oracle. This kind of code:
>
> $sql = "SELECT * FROM table_name WHERE whatever = whatever";
>
> if (DB::isError ($result = $db_con -> query ($sql)))
> echo DB::errorMessage($result);
> else
> while ($resultRow = $result -> fetchRow())
> {
> echo $resultRow[0] . '<BR>';
> }
>
> ... retrieves the desired results, then produces this error:
>
> Warning: Undefined index: in /usr/local/lib/php/DB/common.php on line
> 127
>
> ... once, then this one:
>
> Warning: Undefined offset: 1002 in /usr/local/lib/php/DB/common.php on
> line 127
>
> ... in an infinite loop until the script dies.
>
> Simply replacing the fetchRow() function with the same one from DB.php,
> 1.53 fixes the problem.
>
> I posted something similar earlier this week (look for 'oci8.php
> bugfix') which was fixed in 1.52. Is there a problem, generally,
> checking for 'no more rows'/EOF with Oracle?
The problem is that the fetchrow() was corrected with your patch, but
the fetchInto() was not updated. Now, fetchrow() is deprecated and all
the "fetch row work" is done by fetchInto().
The real solution to that problem is to fix the fetchInto() from
oci8.php.
I think something like replacing:
if (!($arr && $moredata)) {
return $this->oci8RaiseError($result);
}
With:
if (!$moredata) {
return NULL;
}
Tomas V.V.Cox