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: enable SQLite math functions (#553)
vrustx7c0ed986c1fd
diff --git a/.cargo/config.toml b/.cargo/config.tomlindex 6c00888368..92fc9a760d 100644--- a/.cargo/config.toml+++ b/.cargo/config.toml@@ -1,2 +1,6 @@+[env]+# Enable SQLite's built-in math functions for rusqlite's bundled libsqlite3.+LIBSQLITE3_FLAGS = "SQLITE_ENABLE_MATH_FUNCTIONS"+[target.x86_64-pc-windows-msvc]linker = "lld-link"diff --git a/crates/dbx-core/src/db/sqlite.rs b/crates/dbx-core/src/db/sqlite.rsindex 5d28e94194..57b97c5ab3 100644--- a/crates/dbx-core/src/db/sqlite.rs+++ b/crates/dbx-core/src/db/sqlite.rs@@ -178,6 +178,32 @@ mod tests {assert_eq!(result.rows[0][0], serde_json::json!("yes"));}+ #[tokio::test]+ async fn bundled_sqlite_math_functions_are_available() {+ let pool = connect_path(":memory:").await.expect("connect in-memory SQLite");++ let floor_result =+ execute_query(&pool, "WITH test(x) AS (VALUES (1.1), (1.2), (1.3)) SELECT FLOOR(x) FROM test")+ .await+ .expect("FLOOR() should be available");++ assert_eq!(floor_result.rows.len(), 3);+ for row in floor_result.rows {+ assert_eq!(row[0].as_f64(), Some(1.0));+ }++ let result = execute_query(&pool, "SELECT ACOS(1.0), ACOSH(1.0), ASIN(0.0), CEIL(1.2), PI()")+ .await+ .expect("SQLite math functions should be available");++ assert_eq!(result.rows[0][0].as_f64(), Some(0.0));+ assert_eq!(result.rows[0][1].as_f64(), Some(0.0));+ assert_eq!(result.rows[0][2].as_f64(), Some(0.0));+ assert_eq!(result.rows[0][3].as_f64(), Some(2.0));+ let pi = result.rows[0][4].as_f64().expect("PI() returns a real value");+ assert!((3.14..3.15).contains(&pi));+ }+#[tokio::test]async fn substring_rewrite_works_in_direct_query() {let pool = connect_path(":memory:").await.expect("connect in-memory SQLite");