|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-07-09 01:04 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010-07-09 01:04 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 18:00:01 2025 UTC |
Description: ------------ When you select and fetch integers and reals from an SQLite database, they are returned as strings. Why? I would prefer that when I fetch an integer (or a float), the SQLite PDO driver give me an integer (or a float) rather than converting everything to a string (which is annoying). Thanks! Test script: --------------- <?php $pdo = new PDO ('sqlite::memory:'); // $select = $pdo->query ('select 5 as foo, typeof (5) as bar;'); $select = $pdo->query ('select 5.0 as foo, typeof (5.0) as bar;'); $row = $select->fetch (PDO::FETCH_ASSOC); print "actual result:\n"; var_dump ($row); print "\n"; print "expected result:\n"; $row['foo'] = (float) 5.0; var_dump ($row); ?> Expected result: ---------------- array(2) { ["foo"]=> float(5) ["bar"]=> string(4) "real" } Actual result: -------------- array(2) { ["foo"]=> string(3) "5.0" ["bar"]=> string(4) "real" }