|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[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
[2015-09-20 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
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" }