On Thu, 10 Feb 2011 15:21:57 -0500, Yves Goergen  
<nospam.l...@unclassified.de> wrote:

> On 07.02.2011 23:47 CE(S)T, Samuel Adam wrote:
>> On Mon, 07 Feb 2011 03:16:54 -0500, Philip Graham Willoughby
>> <phil.willoug...@strawberrycat.com> wrote:
>>> What about:
>>>
>>> UPDATE "message_revision" SET "Data" = CAST ("Data" AS BLOB);
>>
>> Y’know the urban legend about the folks at the restaurant who design a
>> complicated plan for switching the contents of salt and pepper shakers
>> which have their hats juxtaposed, and then a passer-by suggests just
>> switching the caps?
>
> I don't know that story nor do I understand it. But would that trigger
> thing work? That would be something I could set up easily.

Off-topic not-quite-analogy by way of jest at self.  I suggested a  
temporary workaround which was a hair’s breadth from permanently fixing  
your existing data; Mr. Willoughby pointed that out with the above-quoted  
UPDATE line.  As to Mr. Willoughby’s triggers (which you snipped), yes,  
they look quite correct and you should try them.

> It's not that important issue for my anymore. I've simply decided to not
> store binary data in the SQLite database in this application anymore but
> instead write it to disk. Storing files in the database should only be
> of interest here if you cannot write to disk, but when using SQLite you
> obviously can do that.

For the archives, I emphasize hereby again that SQLite is not 8-bit  
crippled.  I insert and retrieve ordinary-sized images, audio, PDFs, &c.  
 from SQLite on a regular basis; I don’t have problems, because I bind such  
things as BLOB.  I also oft use core function length() on BLOB values,  
including those containing NUL bytes, again without problems.

If I saw a bug in SQLite, I’d call it that point-blank.  Indeed, I did  
take the opportunity to raise what I argue is a documented design flaw  
(which only affects corner cases and is absolutely irrelevant to your  
problem).  But your problem simply was not caused by any incorrectness in  
SQLite.  As amply explained with reference to docs, you told SQLite you  
were inserting TEXT; so length() complied with its documented behavior for  
measuring the length of TEXT:  It counted Unicode characters, *not bytes*,  
up to and not including the first U+0000.

Very truly,

Samuel Adam ◊ <http://certifound.com/>
763 Montgomery Road ◊ Hillsborough, NJ  08844-1304 ◊ United States
Legal advice from a non-lawyer: “If you are sued, don’t do what the
Supreme Court of New Jersey, its agents, and its officers did.”
http://www.youtube.com/watch?v=iT2hEwBfU1g
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to