|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-05 16:29 UTC] maximkh at yahoo dot com
[2006-08-05 16:35 UTC] maximkh at yahoo dot com
[2006-08-07 20:54 UTC] maximkh at yahoo dot com
[2006-08-13 14:54 UTC] iliaa@php.net
[2006-08-13 15:58 UTC] maximkh at yahoo dot com
[2006-08-14 13:55 UTC] maximkh at yahoo dot com
[2006-08-14 14:08 UTC] tony2001@php.net
[2010-12-03 17:34 UTC] jani@php.net
-Package: Feature/Change Request
+Package: SQLite related
[2010-12-03 17:34 UTC] jani@php.net
-Operating System: Linux/Windows
+Operating System: *
[2011-10-31 18:58 UTC] mikemol at gmail dot com
[2016-06-27 16:19 UTC] cmb@php.net
-Package: SQLite related
+Package: PDO SQLite
[2020-12-23 10:26 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2020-12-23 10:26 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Description: ------------ Hello, I was going through the source for PDO_SQLITE extension, and it looks to me as though the only supported data types are text and null. The native types for SQLite such as INTEGER, REAL, and BLOB are all converted into strings, which not only take up more space, but also take away one of the advantages of SQLite, namely being able to store different data types in the same column. Given that SQLite doesn?t even have column types, this kind of implementation effectively takes away all data-type support altogether. We can use various is_* functions and convert the data ourselves, but that only solves half the problem. If the data is stored in the database as strings, it still takes up a lot more space than it needs to (with ints, and reals). In addition, if BLOB data is converted into utf-8 strings or similar, storing binary data might prove to be a problem, though I haven?t looked into this one yet. Would like to request added support for native SQLite data-types if possible. Reproduce code: --------------- @unlink('example.db'); $db = new PDO('sqlite:example.db'); $db->query('CREATE TABLE my_table (my_column BLOB NULL)'); $db->query('INSERT INTO my_table VALUES (\'text\')'); $db->query('INSERT INTO my_table VALUES (123)'); $db->query('INSERT INTO my_table VALUES (123.45)'); $db->query('INSERT INTO my_table VALUES (NULL)'); $result = $db->query('SELECT * FROM my_table'); foreach ($result as $row) var_dump($row['my_column'])."\n"; Expected result: ---------------- string(4) "text" int(123) float(123.45) NULL Actual result: -------------- string(4) "text" string(3) "123" string(6) "123.45" NULL