I have something like the following:
sqlite3_prepare_v2(db, "SELECT c FROM t WHERE r LIKE ?", -1, &stmt, NULL);
int error = sqlite3_bind_text(stmt, 0, "test%", -1, SQLITE_STATIC);
When executing this, error becomes SQLITE_RANGE (“2nd parameter to sqlite3_bind out of range”), but I don’t have any problem when I use = instead of LIKE.
What am I doing wrong?
From the documentation:
The second argument is the index of the SQL parameter to be set. The leftmost SQL parameter has an index of 1.