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:
1 parent
606019b86c
commit
75d7edda27
7 files changed
+13
-2
No files matched your search
@@ -96,7 +96,11 @@ pub async fn list_tables(client: &ChClient, database: &str) -> Result<Vec<TableI
|
|||||||
.map(|row| {
|
.map(|row| {
|
||||||
let engine = row.get(1).and_then(|v| v.as_str()).unwrap_or("");
|
let engine = row.get(1).and_then(|v| v.as_str()).unwrap_or("");
|
||||||
let table_type = if engine.contains("View") { "VIEW" } else { "BASE TABLE" };
|
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())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ pub fn list_tables(client: &DmClient, schema: &str) -> Result<Vec<TableInfo>, St
|
|||||||
.map(|r| TableInfo {
|
.map(|r| TableInfo {
|
||||||
name: r.first().cloned().unwrap_or_default(),
|
name: r.first().cloned().unwrap_or_default(),
|
||||||
table_type: r.get(1).cloned().unwrap_or_else(|| "TABLE".to_string()),
|
table_type: r.get(1).cloned().unwrap_or_else(|| "TABLE".to_string()),
|
||||||
|
comment: None,
|
||||||
})
|
})
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ pub async fn list_tables(client: &mut GaussdbClient, schema: &str) -> Result<Vec
|
|||||||
TableInfo {
|
TableInfo {
|
||||||
name: r.first().and_then(|v| v.clone()).unwrap_or_default(),
|
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() },
|
table_type: if raw_type.contains("VIEW") { "VIEW".to_string() } else { "TABLE".to_string() },
|
||||||
|
comment: None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect())
|
.collect())
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ pub async fn list_tables(conn: &OracleClient, schema: &str) -> Result<Vec<TableI
|
|||||||
.map(|row| TableInfo {
|
.map(|row| TableInfo {
|
||||||
name: row.get_string(0).unwrap_or("").to_string(),
|
name: row.get_string(0).unwrap_or("").to_string(),
|
||||||
table_type: row.get_string(1).unwrap_or("TABLE").to_string(),
|
table_type: row.get_string(1).unwrap_or("TABLE").to_string(),
|
||||||
|
comment: None,
|
||||||
})
|
})
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ pub async fn list_tables(pool: &SqlitePool, _schema: &str) -> Result<Vec<TableIn
|
|||||||
TableInfo {
|
TableInfo {
|
||||||
name: row.get::<String, _>("name"),
|
name: row.get::<String, _>("name"),
|
||||||
table_type: if t == "view" { "VIEW".to_string() } else { "BASE TABLE".to_string() },
|
table_type: if t == "view" { "VIEW".to_string() } else { "BASE TABLE".to_string() },
|
||||||
|
comment: None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect())
|
.collect())
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ pub async fn list_tables(client: &mut SqlServerClient, schema: &str) -> Result<V
|
|||||||
.map(|row| TableInfo {
|
.map(|row| TableInfo {
|
||||||
name: row.get::<&str, _>(0).unwrap_or("").to_string(),
|
name: row.get::<&str, _>(0).unwrap_or("").to_string(),
|
||||||
table_type: row.get::<&str, _>(1).unwrap_or("BASE TABLE").to_string(),
|
table_type: row.get::<&str, _>(1).unwrap_or("BASE TABLE").to_string(),
|
||||||
|
comment: None,
|
||||||
})
|
})
|
||||||
.collect())
|
.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"
|
"SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'main' ORDER BY table_name"
|
||||||
).map_err(|e| e.to_string())?;
|
).map_err(|e| e.to_string())?;
|
||||||
let rows = stmt
|
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())?;
|
.map_err(|e| e.to_string())?;
|
||||||
Ok(rows.filter_map(|r| r.ok()).collect())
|
Ok(rows.filter_map(|r| r.ok()).collect())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user