     }
     
     /// :nodoc:
+    @inlinable
     public func next() throws -> Void? {
-        if done {
+        if _done {
             // make sure this instance never yields a value again, even if the
             // statement is reset by another cursor.
             return nil
         }
-        switch sqlite3_step(sqliteStatement) {
+        switch sqlite3_step(_sqliteStatement) {
         case SQLITE_DONE:
-            done = true
+            _done = true
             return nil
         case SQLITE_ROW:
             return .some(())
         case let code:
-            statement.database.selectStatementDidFail(statement)
-            throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
-        }
+            try handleErrorCode(code)
+        }
+    }
+    
+    @usableFromInline
+    func handleErrorCode(_ code: Int32) throws -> Never {
+        statement.database.selectStatementDidFail(statement)
+        throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
     }
 }
 

        return columnIndexes[name.lowercased()]
    }
    
    /// Creates a cursor over the statement. This cursor does not produce any
    /// value, and is only intended to give access to the sqlite3_step()
    /// low-level function.
    func makeCursor(arguments: StatementArguments? = nil) -> StatementCursor {
        return StatementCursor(statement: self, arguments: arguments)
    }

    }
}

/// A cursor that iterates a database statement without producing any value.
/// Each call to the next() cursor method calls the sqlite3_step() C function.
///
/// For example:
///
///     try dbQueue.read { db in
///         let statement = db.makeSelectStatement(sql: "SELECT performSideEffect()")
///         let cursor = statement.makeCursor()
///         try cursor.next()
///     }
final class StatementCursor: Cursor {
    public let statement: SelectStatement
    @usableFromInline let _sqliteStatement: SQLiteStatement
    @usableFromInline var _done = false
    
    // Use SelectStatement.cursor() instead
    fileprivate init(statement: SelectStatement, arguments: StatementArguments? = nil) {
        self.statement = statement
        self._sqliteStatement = statement.sqliteStatement
        statement.reset(withArguments: arguments)
    }
    
