ID: 45484
Updated by: [EMAIL PROTECTED]
Reported By: cbidon007 at hotmail dot com
Status: Open
Bug Type: PDO related
Operating System: windows xp
PHP Version: 5.2.6
New Comment:
The string conversion is not a bug in the driver. Its how PDO has been
designed. FETCH:ASSOC will always perform a string conversion regardless
of the driver. Use bindColumn():
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
$stmt = $db->query("SELECT 1");
$stmt->bindColumn(1, $value, PDO::PARAM_INT);
$stmt->fetch(PDO::FETCH_BOUND)
Not respected locale setting might be a bug. Check again using
bindColumn().
Previous Comments:
------------------------------------------------------------------------
[2008-07-11 11:03:57] cbidon007 at hotmail dot com
Description:
------------
Hy,
I use an oracle database and my locale setting for the decimal point is
",".
When I run a SELECT query with a float datatype column, the result is a
string datatype value and the decimal separator is ','.
And PHP don't recognize this as a number.
Why oracle column datatypes are not kept?
Reproduce code:
---------------
$oPDOStmt = $oConn->query("SELECT 12.34 AS NB FROM DUAL");
$arrResult = $oPDOStmt->fetch(PDO::FETCH_ASSOC);
print_r($arrResult);
print gettype($arrResult["NB"]);
Expected result:
----------------
Array
(
[NB] => 12.34
)
Actual result:
--------------
Array
(
[NB] => 12,34
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45484&edit=1