mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 05:11:13 +00:00
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 #422 Signed-off-by: Marcus Griep <marcus@griep.us>
This commit is contained in:
parent
4989327c97
commit
816ea65c39
@ -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)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user