Bug #19342 [Opn]: Associative fetches aren't downcased with MDB2_PORTABILITY_ALL
| From: | marco dot napetti at gmail dot com | Date: | Thu, 22 Mar 2012 13:05:24 +0000 |
| Subject: | Bug #19342 [Opn]: Associative fetches aren't downcased with MDB2_PORTABILITY_ALL | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8420@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19342&edit=1
ID: 19342
Updated by: marco.napetti@gmail.com
Reported By: marco dot napetti at gmail dot com
Summary: Associative fetches aren't downcased with
MDB2_PORTABILITY_ALL
Status: Open
Type: Bug
Package: MDB2_Driver_sqlsrv
Operating System: Windows 7
Package Version: 1.5.0b3
PHP Version: 5.3.10
Roadmap Versions:
New Comment:
I solved adding to file Driver/sqlsrv.php on line 867 this code, copied
from Driver/mssql.php:
if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
$fetchmode = $this->db->fetchmode;
}
Previous Comments:
------------------------------------------------------------------------
[2012-03-22 12:45:25] nappa85
Description:
------------
With all other drivers, using option MDB2_PORTABILITY_ALL, associative
fetches are downcased.
But with sqlsrv driver the fetches remains in the original case.
Test script:
---------------
<?php
require_once('MDB2.php');
$oDB = MDB2::factory(array('phptype' => 'sqlsrv'),
array('portability'
=> MDB2_PORTABILITY_ALL));
$oDB->setFetchMode(MDB2_FETCHMODE_ASSOC);
$oPrepared = $oDB->prepare('SELECT UserID FROM Users');
$oRes = $oPrepared->execute();
$aRes = $oRes->fetchAll();
$oRes->free();
var_dump($aRes);
?>
Expected result:
----------------
array(3) {
[0]=>
array(1) {
["userid"]=>
int(1)
}
[1]=>
array(1) {
["userid"]=>
int(2)
}
[2]=>
array(1) {
["userid"]=>
int(3)
}
}
Actual result:
--------------
array(3) {
[0]=>
array(2) {
["UserID"]=>
int(1)
[0]=>
int(1)
}
[1]=>
array(2) {
["UserID"]=>
int(2)
[0]=>
int(2)
}
[2]=>
array(2) {
["UserID"]=>
int(3)
[0]=>
int(3)
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19342&edit=1