You can't have a variable inside a pattern. Use like '%' || ? || '%' -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Daniel Odom Gesendet: Donnerstag, 26. September 2019 15:26 An: sqlite-users@mailinglists.sqlite.org 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 sqlite-users@mailinglists.sqlite.org 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 sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users