Edit report at http://bugs.php.net/bug.php?id=53353&edit=1
ID: 53353
User updated by: stefan dot mueller at meteotest dot ch
Reported by: stefan dot mueller at meteotest dot ch
Summary: Error retrieving data from MDB database: column is
DOUBLE
Status: Open
Type: Bug
Package: ODBC related
Operating System: Windows 7
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Changing the Testenvironment to:
Windows XP with Microsoft Access Driver (*.mdb) 4.x
It works as expected with PHP 5.2.9 and 5.3.1.
Previous Comments:
------------------------------------------------------------------------
[2010-11-19 10:10:42] stefan dot mueller at meteotest dot ch
Description:
------------
Test environment:
- Windows 7 32bit, PHP 5.2.9 and PHP 5.3.1., MS Access 2002 SP3
- ODBC 'DSN1': Microsoft Access Driver (*.mdb) 6.01.7600.16385
- ODBC 'DSN2': Microsoft Access Driver (*.mdb,*.adccdb) 14.00.4760.1000
- Test to access the database also performed with IDL (www.ittvis.com)
In the access database I have a value -0.0864691123456789 (this is 19
characters long which is important) in a column defined as DOUBLE.
When I connect to the database with 'DSN1' then I get an ASCII 0 back
with PHP 5.2.9 and 5.3.1.
When I connect to the database with 'DSN2' then I get an 'E-2' (the
exponent of the floating point number) back with PHP 5.2.9 and 5.3.1.
When I retrieve the data with IDL from 'DSN1' and 'DSN2' I get the
correct numbers.
When I cut the last character in the access database -0.086469112345678
so that the cell contains only 18 characters, the correct numbers are
retrieved with PHP.
Row from Access DB
163 12 1 1 x 132.449361609318 14.714402153458 75 3.08241316815042
-4.2982786671882 -8.64691123456789E-02 0
Test script:
---------------
$conn = odbc_connect("'DSN1' or 'DSN2', '', '')
or die ("Could not connect to database.");
$sql = "SELECT * FROM table;";
$res = odbc_exec($conn, $sql);
while ($x = odbc_fetch_array($res)){
var_dump($x);
if(!is_numeric($x['column'])) {
var_dump(ord($x['column']));
}
}
odbc_free_result($res);
odbc_close($conn);
Expected result:
----------------
array
'ID' => string '163' (length=3)
'CC' => string '12' (length=2)
'Z3' => string '1' (length=1)
'LFIREG' => string '1' (length=1)
'orgBoden' => string 'x' (length=1)
'cl' => string '132.449361609318' (length=16)
'cd' => string '14.714402153458' (length=15)
'cs' => string '75.0' (length=4)
'incr_cl' => string '3.08241316815042' (length=16)
'decr_cl' => string '-4.2982786671882' (length=16)
'd_cd' => string '-0.0864691123456789' (length=19)
'd_cs' => string '0.0' (length=3)
Actual result:
--------------
array
'ID' => string '163' (length=3)
'CC' => string '12' (length=2)
'Z3' => string '1' (length=1)
'LFIREG' => string '1' (length=1)
'orgBoden' => string 'x' (length=1)
'cl' => string '132.449361609318' (length=16)
'cd' => string '14.714402153458' (length=15)
'cs' => string '75.0' (length=4)
'incr_cl' => string '3.08241316815042' (length=16)
'decr_cl' => string '-4.2982786671882' (length=16)
'd_cd' => string '�' (length=1)
'd_cs' => string '0.0' (length=3)
int 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53353&edit=1