public protocol StatementColumnConvertible

The StatementColumnConvertible protocol grants access to the low-level C interface that extracts values from query results: It can bring performance improvements.

To use it, have a value type adopt both StatementColumnConvertible and DatabaseValueConvertible. GRDB will then automatically apply the optimization whenever direct access to SQLite is possible:

let rows = Row.fetchCursor(db, sql: "SELECT ...")
while let row = try {
    let int: Int = row[0]                 // there
let ints = Int.fetchAll(db, sql: "SELECT ...") // there
struct Player {
    init(row: Row) {
        name = row["name"]                // there
        score = row["score"]              // there

StatementColumnConvertible is already adopted by all Swift integer types, Float, Double, String, and Bool.

  • Initializes a value from a raw SQLite statement pointer.

    For example, here is the how Int64 adopts StatementColumnConvertible:

    extension Int64: StatementColumnConvertible {
        init(sqliteStatement: SQLiteStatement, index: Int32) {
            self = sqlite3_column_int64(sqliteStatement, index)

    This initializer is never called for NULL database values: don’t perform any extra check.

    See for more information.



    init(sqliteStatement: SQLiteStatement, index: Int32)



    A pointer to an SQLite statement.


    The column index.