On Mon, 07 Feb 2011 03:16:54 -0500, Philip Graham Willoughby  
<phil.willoug...@strawberrycat.com> wrote:

>>    SELECT length(CAST ("Data" AS BLOB)) FROM "message_revision";
>
> 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?

Thank you, Mr. Willoughby!

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


> As a one-time command to correct the table. There is also the option of  
> using triggers to ensure future "Data" values are kept as BLOB if the  
> INSERT code cannot be corrected conveniently:
>
> CREATE TRIGGER trigName AFTER INSERT ON "message_revision" WHEN  
> TYPEOF("Data")!='blob' BEGIN UPDATE "message_revision" SET "Data" = CAST  
> ("Data" AS BLOB) WHERE "message_revision".rowid = NEW.rowid; END;
>
> CREATE TRIGGER trigName2 AFTER UPDATE OF "Data" ON "message_revision"  
> WHEN TYPEOF("Data")!='blob' BEGIN UPDATE "message_revision" SET "Data" =  
> CAST ("Data" AS BLOB) WHERE "message_revision".rowid = NEW.rowid; END;
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to