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(oracle): detect connection errors on non-English Windows (closes #208)
t8y27790b6fa045d
diff --git a/crates/dbx-core/src/query.rs b/crates/dbx-core/src/query.rsindex 096afe95ba..b500aab333 100644--- a/crates/dbx-core/src/query.rs+++ b/crates/dbx-core/src/query.rs@@ -83,6 +83,18 @@ pub fn is_connection_error(err: &str) -> bool {|| lower.contains("timed out")|| lower.contains("closed")|| lower.contains("eof")+ || lower.contains("i/o error")+ || is_os_connection_error(&lower)+}++fn is_os_connection_error(lower: &str) -> bool {+ let os_error_codes = ["10053", "10054", "10057", "10058", "10060", "10061"];+ if let Some(pos) = lower.find("os error ") {+ let after = &lower[pos + 9..];+ let code: String = after.chars().take_while(|c| c.is_ascii_digit()).collect();+ return os_error_codes.contains(&code.as_str());+ }+ false}pub fn timeout_error() -> String {@@ -687,4 +699,37 @@ mod tests {assert_eq!(result.unwrap_err(), timeout_error());}++ #[test]+ fn is_connection_error_detects_english_messages() {+ assert!(is_connection_error("connection reset"));+ assert!(is_connection_error("broken pipe"));+ assert!(is_connection_error("reset by peer"));+ assert!(is_connection_error("Connection timed out"));+ assert!(is_connection_error("socket closed"));+ assert!(is_connection_error("unexpected eof"));+ }++ #[test]+ fn is_connection_error_detects_localized_io_errors() {+ assert!(is_connection_error("I/O error: 远程主机强迫关闭了一个现有的连接。 (os error 10054)"));+ assert!(is_connection_error(+ "I/O error: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 (os error 10060)"+ ));+ }++ #[test]+ fn is_connection_error_detects_os_error_codes() {+ assert!(is_connection_error("os error 10053"));+ assert!(is_connection_error("os error 10054"));+ assert!(is_connection_error("os error 10060"));+ assert!(is_connection_error("os error 10061"));+ }++ #[test]+ fn is_connection_error_rejects_non_connection_errors() {+ assert!(!is_connection_error("ORA-00942: table or view does not exist"));+ assert!(!is_connection_error("syntax error at position 5"));+ assert!(!is_connection_error("os error 13"));+ }}