Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b5

Bug #19342 Associative fetches aren't downcased with MDB2_PORTABILITY_ALL
Submitted: 2012-03-22 16:45 UTC
From: nappa85 Assigned:
Status: Duplicate Package: MDB2_Driver_sqlsrv (version 1.5.0b3)
PHP Version: 5.3.10 OS: Windows 7
Roadmaps: (Not assigned)    
Subscription  


 [2012-03-22 16:45 UTC] nappa85 (Marco Napetti)
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) } }

Comments

 [2012-03-22 17:05 UTC] nappa85 (Marco Napetti)
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-04-01 20:09 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Duplicate
Bug #18524