On 1/25/17, Warren Young <[email protected]> wrote:
>
> stCmdString += " AND ‘%?1%’ LIKE ‘%?2%’”;
>
> Then use the sqlite3_bind_*() calls to insert parameters 1 and 2 into the
> string.
Not quite. You cannot have parameters embedded in the middle of
strings. The whole string is replaced by a parameter.
stCmdString += " AND fstInfo LIKE ?1 AND fstInfo LIKE ?2"
Then the application has to prepend and append the "%" on the strings
before binding. Or, if your application does not want to do that:
stCmdString += " AND fstInfo LIKE ('%' || ?1 || '%') AND fstInfo
LIKE ('%' || ?2 || '%')"
Then you can bind the search patterns directly to ?1 and ?2. (Aside:
|| is the string concatenation operator in SQL.)
--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users