From 7f484918fee1fc7273e017e86e692be3b5c02c32 Mon Sep 17 00:00:00 2001 From: Flavian Desverne Date: Wed, 19 Apr 2023 11:25:27 +0200 Subject: [PATCH 1/2] fix: pass client_found_rows on latest mysql_async --- src/connector/mysql.rs | 4 +++- src/tests/query.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/connector/mysql.rs b/src/connector/mysql.rs index a94c4697..104e53a1 100644 --- a/src/connector/mysql.rs +++ b/src/connector/mysql.rs @@ -314,7 +314,9 @@ impl MysqlUrl { .stmt_cache_size(Some(0)) .user(Some(self.username())) .pass(self.password()) - .db_name(Some(self.dbname())); + .db_name(Some(self.dbname())) + // See https://github.com/prisma/prisma-engines/pull/3679 as to why this is needed. + .client_found_rows(true); match self.socket() { Some(ref socket) => { diff --git a/src/tests/query.rs b/src/tests/query.rs index ad0d177f..ae8a9667 100644 --- a/src/tests/query.rs +++ b/src/tests/query.rs @@ -3564,3 +3564,23 @@ async fn overflowing_int_errors_out(api: &mut dyn TestApi) -> crate::Result<()> Ok(()) } + +// TODO: Couldn't run this test on latest MySQL because of a compile error +// TODO: Once the compile error is fixed and we get back to latest MySQL, +// TODO: Uncomment me and make sure it returns `1` for mysql on a noop update +// async fn noop_update(api: &mut dyn TestApi) -> crate::Result<()> { +// let table = api.create_temp_table("id int4 name varchar(255)").await?; +// +// let insert = Insert::multi_into(&table, vec!["id", name]) +// .values(vec![1, "Romulus"]) +// .values(vec![2, "Remus"]); +// +// api.conn().query(insert.into()).await?; +// +// let update = Update::table(&table).set("name", "Romulus").so_that("id".equals(1)); +// let changes = api.conn().execute(update.into()).await?; +// +// assert_eq!(1, changes); +// +// Ok(()) +// } From 11bcb2c9125700c5a4b4f07aefd4d6883a0851f6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 09:27:37 +0000 Subject: [PATCH 2/2] Format Rust code using rustfmt --- src/tests/query.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tests/query.rs b/src/tests/query.rs index ae8a9667..03502117 100644 --- a/src/tests/query.rs +++ b/src/tests/query.rs @@ -3570,17 +3570,17 @@ async fn overflowing_int_errors_out(api: &mut dyn TestApi) -> crate::Result<()> // TODO: Uncomment me and make sure it returns `1` for mysql on a noop update // async fn noop_update(api: &mut dyn TestApi) -> crate::Result<()> { // let table = api.create_temp_table("id int4 name varchar(255)").await?; -// +// // let insert = Insert::multi_into(&table, vec!["id", name]) // .values(vec![1, "Romulus"]) // .values(vec![2, "Remus"]); -// +// // api.conn().query(insert.into()).await?; -// +// // let update = Update::table(&table).set("name", "Romulus").so_that("id".equals(1)); // let changes = api.conn().execute(update.into()).await?; -// +// // assert_eq!(1, changes); -// +// // Ok(()) // }