0

Sqlite3 provides the sqlite3_bind_* functions which allow one to do parameter substitution into a SQL query. My question is: what is the right way to combine this with LIKE queries? For example, I might want to do:

SELECT * FROM thing WHERE name LIKE '%?'

but that doesn't work at all. Is the best way really just:

SELECT * FROM thing WHERE name LIKE ?

and then put the pattern characters into the actual string value to be substituted?

4

1 回答 1

0

To concatenate strings, use the || operator:

SELECT * FROM thing WHERE name LIKE '%' || ?
于 2013-10-30T18:16:03.970 回答