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: add missing comment field to TableInfo initializers

t8y275d7edda27d8
diff --git a/crates/dbx-core/src/db/clickhouse_driver.rs b/crates/dbx-core/src/db/clickhouse_driver.rs
index 6679d67194..0045ff1d72 100644
--- a/crates/dbx-core/src/db/clickhouse_driver.rs
+++ b/crates/dbx-core/src/db/clickhouse_driver.rs
@@ -96,7 +96,11 @@ pub async fn list_tables(client: &ChClient, database: &str) -> Result<Vec<TableI
.map(|row| {
let engine = row.get(1).and_then(|v| v.as_str()).unwrap_or("");
let table_type = if engine.contains("View") { "VIEW" } else { "BASE TABLE" };
- TableInfo { name: row[0].as_str().unwrap_or("").to_string(), table_type: table_type.to_string() }
+ TableInfo {
+ name: row[0].as_str().unwrap_or("").to_string(),
+ table_type: table_type.to_string(),
+ comment: None,
+ }
})
.collect())
}
diff --git a/crates/dbx-core/src/db/dm_driver.rs b/crates/dbx-core/src/db/dm_driver.rs
index 2e48fff559..fc3aba1547 100644
--- a/crates/dbx-core/src/db/dm_driver.rs
+++ b/crates/dbx-core/src/db/dm_driver.rs
@@ -110,6 +110,7 @@ pub fn list_tables(client: &DmClient, schema: &str) -> Result<Vec<TableInfo>, St
.map(|r| TableInfo {
name: r.first().cloned().unwrap_or_default(),
table_type: r.get(1).cloned().unwrap_or_else(|| "TABLE".to_string()),
+ comment: None,
})
.collect())
}
diff --git a/crates/dbx-core/src/db/gaussdb_driver.rs b/crates/dbx-core/src/db/gaussdb_driver.rs
index bf833b51b8..bd99c150e8 100644
--- a/crates/dbx-core/src/db/gaussdb_driver.rs
+++ b/crates/dbx-core/src/db/gaussdb_driver.rs
@@ -78,6 +78,7 @@ pub async fn list_tables(client: &mut GaussdbClient, schema: &str) -> Result<Vec
TableInfo {
name: r.first().and_then(|v| v.clone()).unwrap_or_default(),
table_type: if raw_type.contains("VIEW") { "VIEW".to_string() } else { "TABLE".to_string() },
+ comment: None,
}
})
.collect())
diff --git a/crates/dbx-core/src/db/oracle_driver.rs b/crates/dbx-core/src/db/oracle_driver.rs
index 15350e3580..0f7b3c6040 100644
--- a/crates/dbx-core/src/db/oracle_driver.rs
+++ b/crates/dbx-core/src/db/oracle_driver.rs
@@ -99,6 +99,7 @@ pub async fn list_tables(conn: &OracleClient, schema: &str) -> Result<Vec<TableI
.map(|row| TableInfo {
name: row.get_string(0).unwrap_or("").to_string(),
table_type: row.get_string(1).unwrap_or("TABLE").to_string(),
+ comment: None,
})
.collect())
}
diff --git a/crates/dbx-core/src/db/sqlite.rs b/crates/dbx-core/src/db/sqlite.rs
index b83672f0e8..ca1a661126 100644
--- a/crates/dbx-core/src/db/sqlite.rs
+++ b/crates/dbx-core/src/db/sqlite.rs
@@ -47,6 +47,7 @@ pub async fn list_tables(pool: &SqlitePool, _schema: &str) -> Result<Vec<TableIn
TableInfo {
name: row.get::<String, _>("name"),
table_type: if t == "view" { "VIEW".to_string() } else { "BASE TABLE".to_string() },
+ comment: None,
}
})
.collect())
diff --git a/crates/dbx-core/src/db/sqlserver.rs b/crates/dbx-core/src/db/sqlserver.rs
index fa05f6f2e9..db7443fe0a 100644
--- a/crates/dbx-core/src/db/sqlserver.rs
+++ b/crates/dbx-core/src/db/sqlserver.rs
@@ -106,6 +106,7 @@ pub async fn list_tables(client: &mut SqlServerClient, schema: &str) -> Result<V
.map(|row| TableInfo {
name: row.get::<&str, _>(0).unwrap_or("").to_string(),
table_type: row.get::<&str, _>(1).unwrap_or("BASE TABLE").to_string(),
+ comment: None,
})
.collect())
}
diff --git a/crates/dbx-core/src/schema.rs b/crates/dbx-core/src/schema.rs
index 591481ef2e..5d5ec40deb 100644
--- a/crates/dbx-core/src/schema.rs
+++ b/crates/dbx-core/src/schema.rs
@@ -9,7 +9,9 @@ pub fn duckdb_query_tables(con: &duckdb::Connection) -> Result<Vec<db::TableInfo
"SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'main' ORDER BY table_name"
).map_err(|e| e.to_string())?;
let rows = stmt
- .query_map([], |row| Ok(db::TableInfo { name: row.get::<_, String>(0)?, table_type: row.get::<_, String>(1)? }))
+ .query_map([], |row| {
+ Ok(db::TableInfo { name: row.get::<_, String>(0)?, table_type: row.get::<_, String>(1)?, comment: None })
+ })
.map_err(|e| e.to_string())?;
Ok(rows.filter_map(|r| r.ok()).collect())
}