Re: [sqlite] The LIKE operator and Swift

2019-09-27 Thread J. King
On September 26, 2019 9:26:23 a.m. EDT, Daniel Odom wrote: >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 '%?%'" As others have said, '?'

Re: [sqlite] The LIKE operator and Swift

2019-09-27 Thread Gwendal Roué
You can build your pattern in Swift, and use a single parameter: let queryString = "select name, phone, street, city, state from phone where name like '?'" let pattern = "%\(name)%" if sqlite3_bind_text(stmt, 1, pattern, -1, SQLITE_TRANSIENT) != SQLITE_OK {do whatever} For a more

[sqlite] The LIKE operator and Swift

2019-09-26 Thread Daniel Odom
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