-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
How to bind Vec<i64> arguments for IN operator? #528
Comments
Which database are you using? |
mysql 5.6; and now I use sqlx master(0.4.0-pre) |
MySQL does not support arrays of values for bind parameters. You would need to generate a query that has as many bind placeholders as values in your array, and then bind each one individually. We don't provide anything to do that right now, but are discussing it in #291. |
I don't not MySQL protocol detail. let ids = vec![4353455,234234];
let id_str = ids.iter().map(ToString::to_string).collect::<Vec<String>>().join(",");
sqlx::query("SELECT * FROM xx WHERE id IN (?)).bind(id_str).fetch_all(&mut conn) but it just return record for the first id, seems MySQL try to transfrom id_str( |
That won't work, you just queried MySQL with |
seems not exactly. finally, have to workaround with |
seems not work?
The text was updated successfully, but these errors were encountered: