ID:               44629
 User updated by:  lapo at lapo dot it
 Reported By:      lapo at lapo dot it
-Status:           Feedback
+Status:           Open
 Bug Type:         PDO related
 Operating System: *
 PHP Version:      5.2.5
 New Comment:

If PDO_PARAM_LOB accepts a string then this bug is not valid, but OTOH
it could be changed to a documentation bug probably.
IMHO "PDO::PARAM_LOB tells PDO to map the data as a stream, so that you
can manipulate it using the PHP Streams API." doesn't express very
clearly the idea that "also a normal string can do".


Previous Comments:
------------------------------------------------------------------------

[2008-04-03 14:39:23] [EMAIL PROTECTED]

PDO_PARAM_LOB accepts a resource or a string.

Not sure why another type is needed, though the fix is only in 5.3+.

------------------------------------------------------------------------

[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

Reply via email to