ID: 45484
User updated by: cbidon007 at hotmail dot com
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 problem is still here.
I have a french system with the decimal separator ","
I would like to get a float number (e.g. 12.34). When is use
bindColumn(), I get 12 if I use the PDO::PARAM_INT or 12,34 if I use the
PDO::PARAM_STR.
Is it possible to retreive a float number with PDO in this condition ?
Previous Comments:
------------------------------------------------------------------------
[2008-08-05 08:50:14] [EMAIL PROTECTED]
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().
------------------------------------------------------------------------
[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