From b5d16fb211fc6a0d5c892269536a95da803eabae Mon Sep 17 00:00:00 2001 From: Flavian Desverne Date: Tue, 7 Feb 2023 16:28:42 +0100 Subject: [PATCH] fix: pass CLIENT_FOUND_ROWS (#1) This changes the behavior of the affected count returned for mutations (UPDATE/INSERT etc). It makes MySQL return the FOUND rows instead of the AFFECTED rows. Without this, MySQL returns 0 affected row when performing a noop update. This breaks the QueryEngine when performing nested connects which expect the update to have happened. You can read more about it here https://dev.mysql.com/doc/refman/8.0/en/information-functions.html. --- src/opts.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opts.rs b/src/opts.rs index 2e98c41f..275c42e9 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -698,7 +698,8 @@ impl Opts { | CapabilityFlags::CLIENT_MULTI_RESULTS | CapabilityFlags::CLIENT_PS_MULTI_RESULTS | CapabilityFlags::CLIENT_DEPRECATE_EOF - | CapabilityFlags::CLIENT_PLUGIN_AUTH; + | CapabilityFlags::CLIENT_PLUGIN_AUTH + | CapabilityFlags::CLIENT_FOUND_ROWS; if self.inner.mysql_opts.db_name.is_some() { out |= CapabilityFlags::CLIENT_CONNECT_WITH_DB;