Req #30916 [Opn->Wfx]: odbc_fetch_array function only return associative array
| From: | cmb@php.net | Date: | Fri, 12 Aug 2016 12:16:32 +0000 |
| Subject: | Req #30916 [Opn->Wfx]: odbc_fetch_array function only return associative array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203212@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=30916&edit=1
ID: 30916
Updated by: cmb@php.net
Reported by: halla at laptopinformation dot com
Summary: odbc_fetch_array function only return associative
array
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: ODBC related
Operating System: WinXP
PHP Version: 5.0.2
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This won't be implemented; use PDO for consistent behavior
across databases, or use the simple workaround:
array_values($row) + $row
Previous Comments:
------------------------------------------------------------------------
[2004-11-27 05:26:47] halla at laptopinformation dot com
Description:
------------
Hello,
The other x_fetch_array functions you provide return an associative AND numeric array.
We are are trying to port our code to odbc_fetch_array (from sqlite_fetch_array and
mysql_fetch_array) and the code has mixed numeric and associative references.
Because of the mixture we cannot use the odbc_fetch_array function, as any returned arrays that are
dependent on numeric arrays fail.
Why is this not a consistent function, and is there a workaround ?
Is there a way to have the fetch_array function return a $row array for odbc with a numeric and
associative index.
Reproduce code:
---------------
We have a class for each database called xxxxDatabase where xxxx = sqlite, mysql or odbc.
This is the fetch_array function;
function fetch_array($result) {
$row = odbc_fetch_array($result);
return $row
}
This only returns an associative array.
function fetch_array($result) {
$row = mysql_fetch_array($result);
return $row
}
This return an associative and numeric array
Expected result:
----------------
To get an array that contains associative AND numeric indexes
Actual result:
--------------
Associative only - not consistent with other database fetch array functions
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=30916&edit=1