Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(mysql): retry re-prepared statements with text protocol

t8y2bc3c7c52ead6
diff --git a/crates/dbx-core/src/db/mysql.rs b/crates/dbx-core/src/db/mysql.rs
index 507400dc24..affc4bda6b 100644
--- a/crates/dbx-core/src/db/mysql.rs
+++ b/crates/dbx-core/src/db/mysql.rs
@@ -696,6 +696,7 @@ fn mysql_error_should_retry_without_ssl(error: &str) -> bool {
fn mysql_error_should_retry_with_text_protocol(error: &str) -> bool {
let lower = error.to_ascii_lowercase();
(lower.contains("1105") && lower.contains("hy000"))
+ || (lower.contains("1615") && lower.contains("re-prepared"))
|| lower.contains("com_stmt_prepare")
|| lower.contains("prepared statement protocol")
|| lower.contains("this command is not supported in the prepared statement protocol yet")
@@ -2065,6 +2066,13 @@ mod tests {
assert!(mysql_error_should_retry_with_text_protocol(error));
}
+ #[test]
+ fn mysql_reprepared_statement_error_can_retry_with_text_protocol() {
+ let error = "Server error: ERROR HY000 (1615): Prepared statement needs to be re-prepared";
+
+ assert!(mysql_error_should_retry_with_text_protocol(error));
+ }
+
#[test]
fn mysql_setup_queries_select_requested_database_before_session_init() {
let queries = mysql_setup_queries("mysql://root:secret@localhost:3306/app?charset=utf8mb4");