Hi All,

Could someone tell me how to use bound parameters with LIKE and where
the % wildcards should be placed?

I currently have the following code extract:
char *sql = "SELECT * FROM foo WHERE name LIKE :bp";

rc = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, &tail);
sqlite3_bind_text( stmt,
                          sqlite3_bind_parameter_index(stmt, "%:bp%"),
                          "bar",
                          -1,
                         SQLITE_TRANSIENT );

It compiles but doesn't return any results.

If I directly query the database using:
SELECT * FROM foo WHERE name LIKE %bar%;

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

Reply via email to