RE: [PEAR] MDB, Databases : problem with uppercase field names and array keys

From: Date: Thu, 18 Dec 2003 09:29:50 +0000
Subject: RE: [PEAR] MDB, Databases : problem with uppercase field names and array keys
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9643@lists.php.net to get a copy of this message
> From: Vincent DUPONT [mailto:Vincent.dupont@ausy.be] > Sent: Thursday, December 18, 2003 10:29 AM > To: pear-general@lists.php.net > Subject: [PEAR] MDB, Databases : problem with uppercase field names and > array keys > > hello all, > > I use MDB to create an application that will run under MySQL and Oracle. > It works very well except one thing : > > I retrieve the data in associative arrays (ex. with MDB::fetchAll) and > point to any value in these arrays using lowercase keys. > For example : > $data = $conn->fetchAll($result, DB_FETCHMODE_ASSOC); > echo($data['user_id']); > > Under MySQL, this works very well. > Under Oracle, the $data['user_id'] will not work, while getting > $data['USER_ID'] will work. > But I created my tables using a script with Lower case only !! > > I would like to be able to use either lower and upper case in my > associative result arrays. > > I could use 'array_change_key_case($data)' but then I need to do this on > every query. Maybe you know a property, either in PHP, PEAR or Oracle. This problem has already been addressed in the current CVS version and will be part of my next RC release this weekend. If you will have to specify a new option as follows: 'optimize' => 'portability' The default is 'performance' Regards, Lukas

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