fix: add missing comment field to TableInfo initializers
The comment field was added to TableInfo but not updated in clickhouse, gaussdb, oracle, sqlite, sqlserver, dm, and schema drivers.
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user