On 11/9/17, 2:51 PM, "sqlite-users on behalf of Stephen Chrzanowski" 
<sqlite-users-boun...@mailinglists.sqlite.org on behalf of pontia...@gmail.com> 
wrote:
> I've added a simple filter function that uses SQLites LIKE operator, but I'd 
> like something a little bit more advanced.  Right now, the SQL code is like:
> 
> select * from Events where Title like '%Abc%Def%'
> 
>  This works if the Title is AbcRfeDef, but would fail with FedRfeAbc.
> 
> I've thought about doing some kind of delimiter, then have the code generate 
> the SQL code by just looping through the keywords and generate the "or Title 
> like '%keyword%'" statement (With appropriate escaping), but that just smells 
> bad to me.

The best way to do it is not to use complex keys, but if you have to (say 
because the input is free form) then generating

SELECT * FROM EVENTS WHERE title LIKE ‘%Abc%’ AND title LIKE ‘%Def%’;

is probably the only option.
 

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

Reply via email to