From:             
Operating system: Windows
PHP version:      5.2.13
Package:          PDO related
Bug Type:         Bug
Bug description:pdo_mssql is trimming value of the money column

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

        )



)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51213&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51213&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51213&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51213&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51213&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51213&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51213&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51213&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51213&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51213&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51213&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51213&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51213&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51213&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51213&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51213&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51213&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51213&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51213&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51213&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51213&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51213&r=mysqlcfg

Reply via email to