You can't have a variable inside a pattern. Use like '%' || ? || '%'
-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[email protected]] Im
Auftrag von Daniel Odom
Gesendet: Donnerstag, 26. September 2019 15:26
An: [email protected]
Betreff: [EXTERNAL] [sqlite] The LIKE operator and Swift
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 '%?%'"
And then this: if sqlite3_bind_text(stmt, 1, name, -1, SQLITE_TRANSIENT) !=
SQLITE_OK {do whatever}
I get an error "column index out of range". The rest of the code is fine. When
I do this:
let queryString = "select name, phone, street, city, state from phone where
name = ?"
everything works just fine. What am I missing?
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___________________________________________
Gunter Hick | Software Engineer | Scientific Games International GmbH |
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43
1 80100 - 0
May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users