On Aug 17, 2010, at 9:28 PM, Igor Tandetnik wrote:

> Doug Reeder <reeder...@gmail.com> wrote:
>> I need to search for string prefix matches; for example given the  
>> path 'PP',
>> I need to find 'PPA', 'PPBJQ', and 'PPz'.  (The character set is all
>> characters greater than or equal to 'A', and is case-sensitive.)   A
>> statement that does exactly what I want is
>>
>> "UPDATE item SET hasChildren = EXISTS (SELECT path FROM item AS c  
>> WHERE
>> substr(c.path, 1, length(item.path)) == item.path AND  
>> length(c.path) >
>> length(item.path)) WHERE path = ? OR path = ?"
>
> Try this:
>
> select path from item as c
> where c.path > item.path and c.path <= item.path || 'z'
>
> You can use a large codepoint (say, U+FFFF - it's not a valid  
> Unicode character, but SQLite won't complain) in place of 'z'.
> -- 
> Igor Tandetnik

That does what I need! Thanks!

Does SQLite treat strings as sequences of opaque 16-bit values, except  
for the wildcard operators for LIKE and GLOB?  Does it care about  
surrogate code points?  Does it care about FDD0 to FDEF ?


Doug Reeder
reeder...@gmail.com
http://reeder29.livejournal.com/
https://twitter.com/reeder29

https://twitter.com/hominidsoftware
http://outlinetracker.com








_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to