SelectStatement
public final class SelectStatement : Statement
A subclass of Statement that fetches database rows.
You create SelectStatement with the Database.makeSelectStatement() method:
try dbQueue.read { db in
let statement = try db.makeSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?")
let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
}
-
The database region that the statement looks into.
Declaration
Swift
public internal(set) var databaseRegion: DatabaseRegion
-
The number of columns in the resulting rows.
Declaration
Swift
public var columnCount: Int { get }
-
The column names, ordered from left to right.
Declaration
Swift
public lazy var columnNames: [String] { get set }
-
Returns the index of the leftmost column named
name
, in a case-insensitive way.Declaration
Swift
public func index(ofColumn name: String) -> Int?