#29324 [Opn]: Severe problems with NexusDB ODBC driver
| From: | wez@php.net | Date: | Thu, 22 Jul 2004 12:54:09 +0000 |
| Subject: | #29324 [Opn]: Severe problems with NexusDB ODBC driver | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63345@lists.php.net to get a copy of this message | ||
ID: 29324
Updated by: wez@php.net
Reported By: groenink at xs4all dot nl
Status: Open
Bug Type: ODBC related
Operating System: Windows XP
PHP Version: 5.0.0
New Comment:
I know this is side-stepping the issue slightly, but would you mind
testing the PDO?
For a bit more info:
http://netevil.org/node.php?uuid=bf0a58d7-68ab-49d0-9a29-f5ec97c5dfde
You'll need:
http://snaps.php.net/win32/PECL_5_0/php_pdo.dll
http://snaps.php.net/win32/PECL_5_0/php_pdo_odbc.dll
Please reply directly to me (wez@php.net) with feedback on PDO.
Previous Comments:
------------------------------------------------------------------------
[2004-07-22 12:01:13] groenink at xs4all dot nl
Description:
------------
Accessing a NexusDB database from PHP using the ODBC driver results in
two problems, that cannot be reproduced using any other ODBC query
tools:
(1) The columns returned by odbc_fetch_array() are not indexed by their
column names, but by the values!!!
(2) Getting one row with odbc_fetch_array() is fine, but as soon as you
ask for the second one, the web server complains about an access
violation (both Apache and IIS).
Apparently the driver does something that the ODBC library in PHP
doesn't expect, but most other windows programs think is fine.
The problem exists in PHP 4.3.7 as well as PHP 5.0.0.
Reproduce code:
---------------
$db = odbc_connect("nexusdb", "", "");
// Don't use "select *", it will crash immediately.
// This is something the other ODBC tools seem to
// know and deal with as well.
//
$result = odbc_exec($db, "SELECT id, name FROM table");
$num_records_fetched = 0;
$num_records_to_fetch = 2;
while ($row = odbc_fetch_array($result)) {
$num_records_fetched++;
echo "Row {$num_records_fetched}:";
foreach ($row as $key => $value) {
echo " {$key} => {$value}";
}
if ($num_records_fetched >= $num_records_to_fetch) {
break;
}
}
Expected result:
----------------
I'd expect to see:
row 1: id => 0001 name => foo
row 2: id => 0002 name => bar
Actual result:
--------------
I get an "access violation".
If I change "num_records_to_fetch" to 1, it no longer violates access,
but I see this instead:
row 1: 0001 => 0001 foo => foo
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29324&edit=1