#25126 [Ana->Csd]: DB::getAssoc() does not use default fetch mode
| From: | cox@php.net | Date: | Thu, 28 Aug 2003 14:31:22 +0000 |
| Subject: | #25126 [Ana->Csd]: DB::getAssoc() does not use default fetch mode | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20751@lists.php.net to get a copy of this message | ||
ID: 25126
Updated by: cox@php.net
Reported By: sjaensch at gmx dot net
-Status: Analyzed
+Status: Closed
Bug Type: PEAR related
Operating System: Linux
PHP Version: 4.3.2
Assigned To: cox
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-08-18 06:40:09] arnaud@php.net
Tomas is on vacation. He will take care of it when he returns.
------------------------------------------------------------------------
[2003-08-18 06:22:01] nicos@php.net
Here is a patch that should fix the issues.
I need feedbacks...
Index: DB/common.php
===================================================================
RCS file: /repository/pear/DB/DB/common.php,v
retrieving revision 1.22
diff -u -u -r1.22 common.php
--- DB/common.php 22 Jul 2003 21:54:16 -0000 1.22
+++ DB/common.php 18 Aug 2003 11:20:54 -0000
@@ -1034,7 +1034,7 @@
*/
function &getAssoc($query, $force_array = false, $params =
array(),
- $fetchmode = DB_FETCHMODE_ORDERED, $group =
false)
+ $fetchmode = 'default', $group = false)
{
settype($params, "array");
if (sizeof($params) > 0) {
@@ -1049,6 +1049,9 @@
} else {
$res = $this->query($query);
}
+ if ($fetchmode == 'default') {
+ $fetchmode = $this->fetchmode;
+ }
if (DB::isError($res)) {
return $res;
Note: I also have a patch that fixes the oci8 problem #25067
------------------------------------------------------------------------
[2003-08-18 05:42:54] sjaensch at gmx dot net
Description:
------------
DB::getAssoc() always returns results in DB_FETCHMODE_ORDERED,
regardless of the mode set with DB:setFetchMode(). I manually have to
call getAssoc($query, FALSE, array(), DB_FETCHMODE_ASSOC) to get column
names as indexes. This is not consistent and not documented.
Contrary to the documentation in
http://pear.php.net/manual/en/package.database.db.db-common.getassoc.php,
the default value for fetchmode is DB_FETCHMODE_ORDERED, as verified in
DB/common.php shipped with PHP 4.3.2 (DB 1.1.3) and DB/common.php from
DB 1.4.0.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25126&edit=1