Bug #57432 [Opn->Fbk]: PDO_ODBC: Wrong indexes for returned row

From: Date: Tue, 08 Sep 2015 22:14:29 +0000
Subject: Bug #57432 [Opn->Fbk]: PDO_ODBC: Wrong indexes for returned row
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195891@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=57432&edit=1 ID: 57432 Updated by: cmb@php.net Reported by: rysenko at gmail dot com Summary: PDO_ODBC: Wrong indexes for returned row -Status: Open +Status: Feedback Type: Bug Package: PDO ODBC Operating System: Windows XP PHP Version: 5.2.0 RC4 Block user comment: N Private report: N New Comment: Is that still an issue with recent PHP versions? Previous Comments: ------------------------------------------------------------------------ [2006-12-15 07:37:59] rysenko at gmail dot com Description: ------------ I'm doing a simple count query against catalogued DB2 database through PDO. By default PDO::FETCH_BOTH mode is used and I expect to see result in 0 index of the fetched row, but it appears in indexes 1 and 2. Same occurs with queries like "SELECT 1+1 FROM arcticles". This only occurs on DB2 through PDO, and doesn't occur on MySQL through PDO, DB2 through ibm_db2 or DB2 through ODBC. So I consider this to be a bug in PDO. Reproduce code: --------------- $conn = new PDO('odbc:CATNAME', 'user', 'pass'); $sql = 'SELECT COUNT(*) FROM articles'; foreach ($conn->query($sql) as $row) { var_dump($row); } Expected result: ---------------- array(2) { [0]=> string(1) "7"} or maybe array(2) { ["COUNT(*)"]=> string(1) "7" [0]=> string(1) "7"} like in MySQL through PDO Actual result: -------------- array(2) { [1]=> string(1) "7" [2]=> string(1) "7" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=57432&edit=1

« previous php.bugs (#195891) next »