Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Plugins/BigQueryDriverPlugin/BigQueryPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ internal final class BigQueryPluginDriver: PluginDatabaseDriver, @unchecked Send
tableType = "TABLE"
}
return PluginTableInfo(name: entry.tableReference.tableId, type: tableType)
}
}.sorted { $0.name.localizedCaseInsensitiveCompare($1.name) == .orderedAscending }
}

func fetchColumns(table: String, schema: String?) async throws -> [PluginColumnInfo] {
Expand Down
7 changes: 4 additions & 3 deletions Plugins/DynamoDBDriverPlugin/DynamoDBPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,10 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
} while lastEvaluated != nil

Self.logger.debug("fetchTables found \(allTableNames.count) tables")
return allTableNames.map { name in
PluginTableInfo(name: name, type: "TABLE")
}
return allTableNames.sorted { $0.localizedCaseInsensitiveCompare($1) == .orderedAscending }
.map { name in
PluginTableInfo(name: name, type: "TABLE")
}
} catch {
Self.logger.error("fetchTables error: \(error.localizedDescription)")
throw error
Expand Down
3 changes: 2 additions & 1 deletion Plugins/MongoDBDriverPlugin/MongoDBPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ final class MongoDBPluginDriver: PluginDatabaseDriver {
}

let collections = try await conn.listCollections(database: currentDb)
return collections.map { PluginTableInfo(name: $0, type: "table", rowCount: nil) }
return collections.sorted(by: { $0.localizedCaseInsensitiveCompare($1) == .orderedAscending })
.map { PluginTableInfo(name: $0, type: "table", rowCount: nil) }
}

func fetchColumns(table: String, schema: String?) async throws -> [PluginColumnInfo] {
Expand Down
4 changes: 2 additions & 2 deletions Plugins/MySQLDriverPlugin/MySQLPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ final class MySQLPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
func fetchTables(schema: String?) async throws -> [PluginTableInfo] {
let result = try await execute(query: "SHOW FULL TABLES")

return result.rows.compactMap { row in
return result.rows.compactMap { row -> PluginTableInfo? in
guard let name = row[safe: 0] ?? nil else { return nil }
let typeStr = (row[safe: 1] ?? nil) ?? "BASE TABLE"
let type = typeStr.contains("VIEW") ? "VIEW" : "TABLE"
return PluginTableInfo(name: name, type: type)
}
}.sorted { $0.name.localizedCaseInsensitiveCompare($1.name) == .orderedAscending }
}

func fetchColumns(table: String, schema: String?) async throws -> [PluginColumnInfo] {
Expand Down
Loading