-
-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong number of statement arguments with "like '%?%'" #530
Labels
Comments
Please see Nike-Inc/SQift#9 for an identical issue. It is a misunderstanding of what SQLite parameters are. |
That's lovely, @Timac! You're right, this is a FAQ :-) I'll soon look into your PR. |
It also works if you put the percent marks in the argument. let notes = Stalker.store.notes(
where: "body LIKE ? AND deleted = 0 ORDER BY date DESC",
arguments: ["%\(query)%"]) |
groue
added a commit
that referenced
this issue
May 29, 2019
Add FAQ to clarify "Wrong number of statement arguments" error with "like '%?%'"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do?
I am trying to perform some SQLite queries using the like operator.
For example I would like to delete all rows from mytable where the title column contains the string "something":
What did you expect to happen?
The SQLite query looks valid. I would expect the query to delete all rows from mytable where the substring is found.
What happened instead?
I see instead an error
SQLite error 21: wrong number of statement arguments: 1
Note that if I use instead the following, I don't see the error and the expected rows are deleted:
A similar issue occurs when using SELECT:
Environment
GRDB flavor(s): GRDB
GRDB version: 4.0 (revision 0e2daff)
Installation method: manual
Xcode version: 10.2.1
Swift version: 5
Platform(s) running GRDB: iOS
macOS version running Xcode: 10.14.4
The text was updated successfully, but these errors were encountered: