Bug #8747 [NEW]: column name mangling in MDB2_FETCHMODE_ASSOC
| From: | budgenator at user dot sourceforge dot net | Date: | Wed, 20 Sep 2006 20:01:37 +0000 |
| Subject: | Bug #8747 [NEW]: column name mangling in MDB2_FETCHMODE_ASSOC | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-8471@lists.php.net to get a copy of this message | ||
From: budgenator at user dot sourceforge dot net
Operating system: linux
Package version:
PHP version: Irrelevant
Package: Documentation
Bug Type: Bug
Bug description: column name mangling in MDB2_FETCHMODE_ASSOC
Description:
------------
in a database table jobs that contains fields Jobs, Case, DueDate,
arrivialDate, RxDate, WOnumber, ShipDate the method
fetchRow(MDB2_FETCHMODE_ASSOC) mangles the associative indices to lower
case and field names become case insensitive without warning or
documentation in MySQL version 5.0.24
Test script:
---------------
#!/usr/bin/php
<?php
require_once 'MDB2.php'; // BSD License
$dsn = array(
'phptype' => 'mysqli',
'hostspec' => 'localhost',
'database' => 'test'
);
$mdb2 =& MDB2::factory($dsn); // create MDB2 instance
$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC); // set the default fetchmode
$query = "SELECT Jobs, jobs.Case, DueDate, arrivialDate, RxDate,
WOnumber, ShipDate FROM jobs WHERE Jobs > 270";
$jobs_result =& $mdb2->query($query);
if (PEAR::isError($jobs_result)) die($jobs_result->getMessage());
echo "$query\n";
$numberOfJobs = $jobs_result->numRows();
echo "returned $numberOfJobs rows\n";
$loop = 1;
while ($job = $jobs_result->fetchRow()) {
echo "while loop interation is $loop, ";
print_r($job);
echo " \n";
$loop++;
}
exit();
?>
Expected result:
----------------
+------+------+------------+--------------+--------+----------+----------+
| Jobs | Case | DueDate | arrivialDate | RxDate | WOnumber | ShipDate
|
+------+------+------------+--------------+--------+----------+----------+
| 271 | 270 | 2006-05-02 | 2006-05-02 | NULL | 19730 | NULL
|
| 272 | 275 | 2006-08-24 | 2006-08-21 | NULL | 15589 | NULL
|
+------+------+------------+--------------+--------+----------+----------+
while loop interation is 1, Array
(
[Jobs] => 271
[Case] => 270
[DueDate] => 2006-05-02
[arrivialdate] => 2006-05-02
[rxdate] =>
[wonumber] => 19730
[shipdate] =>
)
while loop interation is 2, Array
(
[Jobs] => 272
[Case] => 275
[DueDate] => 2006-08-24
[arrivialDate] => 2006-08-21
[RxDate] =>
[WOnumber] => 15589
[ShipDate] =>
)
Actual result:
--------------
while loop interation is 1, Array
(
[jobs] => 271
[case] => 270
[duedate] => 2006-05-02
[arrivialdate] => 2006-05-02
[rxdate] =>
[wonumber] => 19730
[shipdate] =>
)
while loop interation is 2, Array
(
[jobs] => 272
[case] => 275
[duedate] => 2006-08-24
[arrivialdate] => 2006-08-21
[rxdate] =>
[wonumber] => 15589
[shipdate] =>
)
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=8747&edit=1
--