php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37097 PDO-MSSQL converts bigint to float.
Submitted: 2006-04-16 07:44 UTC Modified: 2006-04-30 01:39 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: stochnagara at hotmail dot com Assigned: wez (profile)
Status: Wont fix Package: PDO related
PHP Version: 5.1.3RC2 OS: windows xp
Private report: No CVE-ID: None
 [2006-04-16 07:44 UTC] stochnagara at hotmail dot com
Description:
------------
PDO MsSql driver returns bigint values as float instead of int.
They are always formated as <number>.0

Reproduce code:
---------------
CREATE TABLE demo (
bi bigint not null,
sm int null
);
insert into demo (1,1);

$result = $pdo->query ("SELECT * FROM demo")->fetch();
echo "bi={$result['bi']};"
echo "sm={$result['sm']};"

Expected result:
----------------
bi=1;sm=1;

Actual result:
--------------
bi=1.0;sm=1;

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-16 07:57 UTC] tony2001@php.net
Assigned to the maintainer.

 [2006-04-16 20:14 UTC] wez@php.net
FYI: You should use PDO ODBC on Windows.

 [2006-04-30 01:39 UTC] wez@php.net
That's the stringified format that dblib returns to PDO.
We're not going to "fix" this; we asked for a string and that's the string that is handed to us by dblib.

You should also note that dblib on windows is an unsupported legacy library that has not shipped with SQL server for the last couple of releases; unless you absolutely MUST use it, you are STRONGLY recommended to use ODBC to connect to MSSQL.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC