blackbeam / mysql_async

Asyncronous Rust Mysql driver based on Tokio.
Apache License 2.0
372 stars 113 forks source link

multi query and BinaryProtocol #293

Open zirill opened 4 months ago

zirill commented 4 months ago

HI

Is it possible?

1) query_iter and return BinaryProtocol

or

2) exec_iter and muti query - select 1;select 2;

blackbeam commented 4 months ago

As far as I can tell the closest thing is CLIENT_MULTI_STATEMENTS capability and actually it is enabled by the driver (see here).

This means that if it is enabled on the server side, then you can try to prepare multiple SQL statements using single prepare and try to execute the resulting prepared statement — results should be in binary protocol. Please note that I never tried this so please report in case of issues.

zirill commented 3 months ago

Thanks for the tip, but so far no results.

I'm using mariadb, searched, can't find anywhere how to enable it on the server side.

Everywhere it is specified as a flag on connection.

result = conn.exec_iter("select 1; select 2;", Params::Empty).await?;

ServerError { code: 1064, message: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'select 2' at line 1", state: "42000" }