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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user