blackbeam / rust-mysql-simple

Mysql client library implemented in rust.
Apache License 2.0
665 stars 146 forks source link

How to supply a vector of values for IN clause. #212

Closed jadedevin13 closed 4 years ago

jadedevin13 commented 4 years ago

How can you send a Vector of parameter values for an sql like select * from table_name in ?`.

When I try, it produces an error.

^^^^^^^^^^^^ the trait `std::convert::From<std::vec::Vec<std::string::String>>` is not implemented for `mysql::Value`
blackbeam commented 4 years ago

Hi. Let me cite the docs:

MySql uses ? symbol as a parameter placeholder and it's only possible to use parameters where a single MySql value is expected.

Details:

In accordance to MySql binary protocol, you can supply MySql binary value in place of ? but 'sequence of MySql binary values' is not a MySql binary value.

This question had arisen earlier (see #153).