SelectStatement

public final class SelectStatement : Statement

A subclass of Statement that fetches database rows.

You create SelectStatement with the Database.makeSelectStatement() method:

try dbQueue.inDatabase { db in
    let statement = try db.makeSelectStatement("SELECT COUNT(*) FROM players WHERE score > ?")
    let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
    let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
}
  • Information about the table and columns read by a SelectStatement

    Declaration

    Swift

    public private(set) var selectionInfo: SelectionInfo
  • The number of columns in the resulting rows.

    Declaration

    Swift

    public lazy var columnCount: Int =
  • The column names, ordered from left to right.

    Declaration

    Swift

    public lazy var columnNames: [String] =
  • Returns the index of the leftmost column named name, in a case-insensitive way.

    Declaration

    Swift

    public func index(ofColumn name: String) -> Int?
  • Information about the table and columns read by a SelectStatement

    See more

    Declaration

    Swift

    public struct SelectionInfo : CustomStringConvertible