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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
11 + 27 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 20:01:23 2019 UTC