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
  • Initializes a value from a raw SQLite statement pointer, if possible.

    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. Just return nil for failed conversions: GRDB will interpret a nil result as a decoding failure.

    See for more information.



    init?(sqliteStatement: SQLiteStatement, index: Int32)



    A pointer to an SQLite statement.


    The column index.