|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchespdo_mssql_money_column_conversion_fix (last revision 2010-03-05 09:38 UTC by alexr at oplot dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-03-08 13:39 UTC] iliaa@php.net
[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
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 07:00:01 2025 UTC |
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 ) )