In my sample program I'm trying to do the following:
use futures::StreamExt;
use sqlx::Connection;
#[tokio::main]
async fn main() {
let mut conn = sqlx::MySqlConnection::connect("mysql://user:pass@localhost/db")
.await
.unwrap();
let mut s = sqlx::query(concat!(
"UPDATE foo SET bar=false WHERE id=34;",
"UPDATE foo SET bar=true WHERE id=43;"
))
.execute_many(&mut conn)
.await;
while let Some(k) = s.next().await {
println!("{k:?}");
}
}
But MySQL complains with 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 'UPDATE
error. So the question is how one is supposed to pass multiple queries so that they are properly recognized. Needless to say I am aware that I can run each query individually but I'd like to stack them up all together for performance reasons (server network latency).