php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57432 PDO_ODBC: Wrong indexes for returned row
Submitted: 2006-12-15 07:37 UTC Modified: 2015-09-20 04:22 UTC
From: rysenko at gmail dot com Assigned:
Status: No Feedback Package: PDO ODBC
PHP Version: 5.2.0 RC4 OS: Windows XP
Private report: No CVE-ID: None
 [2006-12-15 07:37 UTC] 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" }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-12 02:12 UTC] ssufficool@php.net
-Summary: Wrong indexes for returned row +Summary: PDO_ODBC: Wrong indexes for returned row -Package: PDO +Package: PDO related
 [2014-01-01 12:43 UTC] felipe@php.net
-Package: PDO related +Package: PDO ODBC
 [2015-09-08 22:14 UTC] cmb@php.net
-Status: Open +Status: Feedback
 [2015-09-08 22:14 UTC] cmb@php.net
Is that still an issue with recent PHP versions?
 [2015-09-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC