On Thu, Dec 01, 2005 at 09:52:25PM -0500, [EMAIL PROTECTED] wrote:
> Suppose you do this:
> 
>    sqlite3_bind_text(pVm, 1, "abc\000xyz\000pq", 10, SQLITE_STATIC);
> 
> If this is part of an INSERT, say, then you will insert a 10-character
> string that happens to contain a couple of extra \000 characters.
> The statement:

This is indeed exactly how DBD::SQLite handles an execute statement
with a blob argument: it's bound as text but with the length set
according to the blob length.   So the retrievals happen exactly as
you describe (although I had not thought to try 'cast as blob').

> So as far as I can tell, both SQLite and Perl are doing exactly what
> they ought to be.

That certainly could be argued, although it does seem to trap the
unwary (like me) with fair regularity.  One option for 'improving' it
might be to make 'BLOB' become a bona fide column affinity, so that a
TEXT type inserted into a BLOB column would be stored as a blob.

Would there be a downside to do this?

--nate

Reply via email to