pdo_mssql is trimming value of the money column
| Bug #51213 | pdo_mssql is trimming value of the money column | ||||
|---|---|---|---|---|---|
| Submitted: | 2010-03-05 10:36 UTC | Modified: | 2010-03-08 13:39 UTC | ||
| From: | alexr at oplot dot com | Assigned: | iliaa (profile) | ||
| Status: | Closed | Package: | PDO related | ||
| PHP Version: | 5.2.13 | OS: | Windows | ||
| Private report: | No | CVE-ID: | None | ||
[2010-03-05 10:36 UTC] alexr at oplot dot com
Description:
------------
Money column is wrongly converting to the char column and this cause that value is rounding to the 2 digits after delimiter (dot).
Test script:
---------------
$dsn = 'mssql:dbname=DBNAME;host=HOSTNAME';
$user = 'USERNAME';
$password='PASSWORD';
$dbh = new PDO($dsn, $user, $password);
$sth = $dbh->query ('create table #tmp(col money)');
$sth = $dbh->query ('insert into #tmp(col) values(-0.1234)');
$sth = $dbh->query ('insert into #tmp(col) values(0.1234)');
$sth = $dbh->prepare('select * from #tmp');
$sth->execute();
$r = $sth->fetchAll(2);
print_r($r);
Expected result:
----------------
Array
(
[0] => Array
(
[col] => -0.1234
)
[1] => Array
(
[col] => 0.1234
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[col] => -0.12
)
[1] => Array
(
[col] => 0.12
)
)
Patches
pdo_mssql_money_column_conversion_fix (last revision 2010-03-05 09:38 UTC by alexr at oplot dot com)Pull Requests
History
AllCommentsChangesGit/SVN commits
[2010-03-08 13:39 UTC] iliaa@php.net
-Status: Open +Status: Closed
[2010-03-08 13:39 UTC] iliaa@php.net
[2010-08-05 21:48 UTC] rgagnon24 at gmail dot com
[2010-08-05 22:13 UTC] rgagnon24 at gmail dot com