On September 26, 2019 9:26:23 a.m. EDT, Daniel Odom <djo...@djodom.com> wrote:
>I am just now getting around to learning Swift and XCode. I am having a
>
>problem with 'LIKE'. When I do this:
>
>let queryString = "select name, phone, street, city, state from phone 
>where name like '%?%'"

As others have said, '?' is a literal character, whereas ? is a parameter. 
Concatenating with || is one solution, though I would personally recommend 
instead preparing your whole pattern in your application logic and passing just 
the parameter to SQLite. Don't forget to escape any literal % and _ characters 
in your input before fencing with %, unless your input is itself a LIKE 
pattern. 

<https://sqlite.org/lang_expr.html#like>
-- 
J. King
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to