fix(mysql): improve compatibility with ProxySQL
Joins the MySQL connection setup statements into a single statement to
prevent issues with ProxySQL, which requires special handling of
connections that might be shared between multiple backends.
Fixes
@@ -139,11 +139,11 @@ impl Connect for MySqlConnection {
// https://mathiasbynens.be/notes/mysql-utf8mb4
- conn.execute(r#"
- SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE'));
- SET time_zone = '+00:00';
- SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
- "#).await?;
+ conn.execute(concat!(
+ r#"SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE')),"#,
+ r#"time_zone='+00:00',"#,
+ r#"NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;"#,
+ )).await?;
Ok(conn)
})
