FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19342&edit=1

ID: 19342
Updated by: [email protected]
Reported By: marco dot napetti at gmail dot com
Summary: Associative fetches aren't downcased with
MDB2_PORTABILITY_ALL
-Status: Open
+Status: Duplicate
Type: Bug
Package: MDB2_Driver_sqlsrv
Operating System: Windows 7
Package Version: 1.5.0b3
PHP Version: 5.3.10
Roadmap Versions:
New Comment:

-Status: Open
+Status: Duplicate
Bug #18524


Previous Comments:
------------------------------------------------------------------------

[2012-03-22 13:05:24] nappa85

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;
}

------------------------------------------------------------------------

[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)
}
}

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedApr 1, '12 at 2:06p
activeApr 1, '12 at 2:06p
posts1
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 1 post

People

Translate

site design / logo © 2023 Grokbase