#44629 [Opn->Fbk]: SQLite3 strings don't accept \0 while PHP ones do it
| From: | scottmac@php.net | Date: | Thu, 03 Apr 2008 14:39:23 +0000 |
| Subject: | #44629 [Opn->Fbk]: SQLite3 strings don't accept \0 while PHP ones do it | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123934@lists.php.net to get a copy of this message | ||
ID: 44629
Updated by: scottmac@php.net
Reported By: lapo at lapo dot it
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: *
PHP Version: 5.2.5
New Comment:
PDO_PARAM_LOB accepts a resource or a string.
Not sure why another type is needed, though the fix is only in 5.3+.
Previous Comments:
------------------------------------------------------------------------
[2008-04-03 14:13:31] lapo at lapo dot it
Description:
------------
While PHP strings support \0s in them, SQLite3 doesn't accept them in
text fields, only in blob fields.
A possible work-around, thanks to the closed bug #41135, is to write to
a memory stream and use PDO::PARAM_LOB, but that seems a bit overkill
for very small "string" values such as the binary form of PHP's sha1().
I think the best solution could be to scan a PDO::PARAM_STR value for
zeros and in that case use sqlite3_bind_blob just as if it was a
PDO::PARAM_LOB.
Or maybe (a little cleaner) create a (non-large) PDO::PARAM_BINARY.
Using streams is certainly the best approach for LOB, but I think it's
overkill for non-large-OBs.
Tell me what of the two solutions the PHP team would prefer to adopt
and I can eventually produce a patch.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44629&edit=1