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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(mysql): return CHECKSUM TABLE result set
Melody Ruchdc8b083c63cb
diff --git a/crates/dbx-core/src/db/mysql.rs b/crates/dbx-core/src/db/mysql.rsindex cf105e5fce..150cddba87 100644--- a/crates/dbx-core/src/db/mysql.rs+++ b/crates/dbx-core/src/db/mysql.rs@@ -5291,7 +5291,7 @@ fn prefers_text_protocol_query(sql: &str, dialect: MySqlQueryDialect) -> bool {pub(crate) fn is_result_set_query(sql: &str, dialect: MySqlQueryDialect) -> bool {starts_with_executable_sql_keyword_for_database(sql,- &["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "WITH", "CALL"],+ &["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "WITH", "CALL", "CHECKSUM"],DatabaseType::Mysql,) || mysql_statement_returns_rows(sql)|| is_xa_recover_query(sql)@@ -6087,6 +6087,14 @@ mod tests {assert!(is_result_set_query("DESC users", MySqlQueryDialect::default()));}+ #[test]+ fn mysql_checksum_queries_are_treated_as_result_sets() {+ let dialect = MySqlQueryDialect::default();++ assert!(is_result_set_query("CHECKSUM TABLE `issue6693_repro`", dialect));+ assert!(prefers_text_protocol_query("CHECKSUM TABLE `issue6693_repro`", dialect));+ }+#[test]fn mysql_call_queries_are_treated_as_text_result_sets() {let dialect = MySqlQueryDialect::default();diff --git a/crates/dbx-core/src/query_execution_sql.rs b/crates/dbx-core/src/query_execution_sql.rsindex 4bd61c028d..63aabdbfc8 100644--- a/crates/dbx-core/src/query_execution_sql.rs+++ b/crates/dbx-core/src/query_execution_sql.rs@@ -211,7 +211,7 @@ pub fn contains_dangerous_sql_keyword(sql: &str) -> bool {/// PRAGMA is intentionally NOT in this list because some PRAGMA statements modify/// database or session state (e.g. SQLite `PRAGMA journal_mode=WAL`). Instead,/// read-only PRAGMA forms are handled separately in `is_safe_read_pragma`.-const READ_SQL_KEYWORDS: &[&str] = &["SELECT", "WITH", "SHOW", "DESCRIBE", "DESC", "EXPLAIN", "FROM"];+const READ_SQL_KEYWORDS: &[&str] = &["SELECT", "WITH", "SHOW", "DESCRIBE", "DESC", "EXPLAIN", "FROM", "CHECKSUM"];/// PRAGMA names that are known to be safe read-only queries in SQLite/DuckDB./// Only the function-call form `PRAGMA name(args)` matching these names is allowed.@@ -1288,6 +1288,7 @@ mod tests {assert!(!is_write_sql("EXPLAIN SELECT * FROM users"));assert!(!is_write_sql("PRAGMA table_info(users)"));assert!(!is_write_sql("FROM users SELECT *"));+ assert!(!is_write_sql("CHECKSUM TABLE `issue6693_repro`"));}#[test]