> If it is possible, how would I define a prepared statement so that I can
> just bind the (10 byte) value into it?

Is it possible to pre-process your 10 bytes and insert e.g. symbol '\'
before any '\', '_' and '%' symbol? After that you can query
SELECT * FROM mytable WHERE myblob LIKE ? ESCAPE '\'


Pavel

On Thu, Jul 8, 2010 at 10:46 AM, Matthew Jones <matthew.jo...@hp.com> wrote:
>  From a web search (and abbreviated):
>
>  >>I have BLOBs in my schema and the data will often start with bytes of
>  >>0 value.
>  >>I'm having a tough time coming up with the proper SQL syntax to
>  >> select all the columns that start with 2 0's (or any zeros).
>
>  > SELECT * FROM mytable WHERE myblob LIKE X'0025';
>  > SELECT * FROM mytable WHERE quote(myblob) LIKE 'X''00%';
>
> Now I have a column of blob data (always 20 bytes) and I would like to
> do a LIKE select on this column where I have the first 10 bytes but they
> can be any value including, of course, the % character. Is this possible
> or does the arbitrary nature of the data make this infeasible?
>
> If it is possible, how would I define a prepared statement so that I can
> just bind the (10 byte) value into it?
>
> Thanks
>
> --
> Matthew Jones
> Hewlett-Packard Ltd
> Long Down Avenue
> Stoke Gifford
> Bristol.  BS34 8QZ
> Tel:   +44 (0) 117 312 7490
> Email:    matthew.jo...@hp.com<mailto:matthew.jo...@hp.com>
>
> Hewlett-Packard Limited registered Office: Cain Road, Bracknell, Berks,
> RG12 1HN. Registered No: 690597 England
>
> The contents of this message and any attachments to it are confidential
> and may be legally privileged. If you have received this message in
> error, you should delete it from your system immediately and advise the
> sender.
>
> To any recipient of this message within HP, unless otherwise stated you
> should consider this message and attachments as "HP CONFIDENTIAL".
> _______________________________________________
> 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