#101 [NEW]: fetchRow method in oci8 backend ignores options["optimize"] setting

From: Date: Tue, 14 Oct 2003 16:19:46 +0000
Subject: #101 [NEW]: fetchRow method in oci8 backend ignores options["optimize"] setting
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22687@lists.php.net to get a copy of this message
From: massimo dot ferrario at inforeti dot it Operating system: linux PHP version: 4.3.2 PHP Bug Type: DB Bug description: fetchRow method in oci8 backend ignores options["optimize"] setting Description: ------------ I found a bug (or is it a feature?) in the fetchRow method implementation of the DB_oci8 class. While fetchInto method checks if $this->options['optimize'] is set to 'portability', and if it is converts all the field names to lower case, fetchRow does not. So, after a fetchRow, the code that looks for $row['key'] finds it empty, as only $row['KEY'] is set. I did not notice this problem before before I always used the DB::fetchRow method, and in the code ->dbh->fetchInto is called. The patch is simple: function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT) { if ($fetchmode == DB_FETCHMODE_DEFAULT) { $fetchmode = $this->fetchmode; } if ($fetchmode & DB_FETCHMODE_ASSOC) { $moredata = @OCIFetchInto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS); } else { $moredata = @OCIFetchInto($result, $row, OCI_RETURN_NULLS + OCI_RETURN_LOBS); } if (!$moredata) { return NULL; } //patch begin elseif ($this->options['optimize'] == 'portability') $row = array_change_key_case($row, CASE_LOWER); //patch else return $row; } Please note that I am using // $Id: oci8.php,v 1.4 2002/07/02 16:39:16 mj Exp $ this version of the oci8 library -- Edit bug report at http://pear.php.net/bugs/bug.php?id=101&edit=1 --

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