Improved progress display

Previously, the progress bar updated only after completing an entire table.

For large tables such as LIBARC, this could make the application appear to have stopped responding.

Phase 10 updates the interface while rows are being exported.
This commit is contained in:
Mark Gregory
2026-10-18 11:46:19 +01:00
parent d96fc225cf
commit c1bfb36de5
4 changed files with 115 additions and 25 deletions
+22
View File
@@ -143,6 +143,8 @@ final class DatabaseModel: ObservableObject {
@Published var databases: [String] = []
@Published var schemaTables: [String: [String]] = [:]
@Published var schemaViews: [String: [String]] = [:]
@Published var schemaProcedures: [String: [String]] = [:]
@Published var schemaFunctions: [String: [String]] = [:]
@Published var schemaColumns: [String: [String]] = [:]
@Published var selectedDatabase = ""
@Published var queryDurationText = ""
@@ -324,6 +326,26 @@ final class DatabaseModel: ObservableObject {
schemaTables[database] = tables
schemaViews[database] = views
// Routine metadata is separate from SHOW FULL TABLES.
// Failure (e.g. insufficient INFORMATION_SCHEMA privileges)
// must not prevent browsing tables and views.
do {
let quotedSchema = database.replacingOccurrences(of: "'", with: "''")
let routineResult = try await NativeMySQLRunner.run(
profile: profile, database: database, password: password,
sql: "SELECT ROUTINE_NAME, ROUTINE_TYPE FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '\(quotedSchema)' ORDER BY ROUTINE_NAME"
)
schemaProcedures[database] = routineResult.rows.compactMap { row in
row.count >= 2 && row[1].uppercased() == "PROCEDURE" ? row[0] : nil
}
schemaFunctions[database] = routineResult.rows.compactMap { row in
row.count >= 2 && row[1].uppercased() == "FUNCTION" ? row[0] : nil
}
} catch {
schemaProcedures[database] = []
schemaFunctions[database] = []
}
// Cache column names for SQL completion. The lookup is read-only,
// scoped to the selected schema and uses the current connection.
// Failures (e.g. metadata permissions) do not prevent table browsing.