mysql_async icon indicating copy to clipboard operation
mysql_async copied to clipboard

multi query and BinaryProtocol

Open zirill opened this issue 11 months ago • 2 comments

HI

Is it possible?

  1. query_iter and return BinaryProtocol

or

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

zirill avatar Mar 09 '24 02:03 zirill

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.

blackbeam avatar Mar 19 '24 19:03 blackbeam

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" }

zirill avatar Mar 25 '24 00:03 zirill