On 01/07/16 05:04, Simon Slavin wrote:
> On 1 Jul 2016, at 10:18am, Rob Golsteijn <[email protected]> wrote:
> 
>> For the tests below I assumed that the intention is that a string ends at 
>> the first embedded nul character.
> 
> I'm not sure that this is the intent.
> 
> The idea that null is a terminating character is something that comes with C.

Under the hood SQLite represents blobs and strings the same way - a
sequence of bytes and a length.  A null is not special and if you use
the C apis then what you get back out is exactly what you put in, nulls
and all.  My test suite and code all verify this on every release.

As Rob has found, some of the SQLite builtin functions are a little
sloppy, where they stop at the length of the bytes, or a null -
whichever comes first.  You'll also find that they quite happily operate
on blobs too.  The similarity of the underlying representation is what
makes that happen.

While SQLite could be fixed, there is also the possibility that some
code somewhere in the billions of SQLite deployed instances depends on
this behaviour (probably even unknowingly).

Roger

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to