diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index fda0b1a51..26730ae41 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -254,7 +254,7 @@ public final class SelectStatement : Statement { } /// Information about the table and columns read by a SelectStatement - public struct SelectionInfo { + public struct SelectionInfo : CustomStringConvertible { mutating func insert(column: String, ofTable table: String) { if selection[table] != nil { selection[table]!.insert(column) @@ -272,6 +272,14 @@ public final class SelectStatement : Statement { } private var selection: [String: Set] = [:] // [TableName: Set] + + /// A textual representation of `self`. + public var description: String { + return selection + .sorted { $0.key < $1.key } + .map { (table, columns) in "\(table)(\(columns.sorted().joined(separator: ", ")))" } + .joined(separator: ", ") + } } }