RawPreparedStatement extension type

Unsafe, raw access to a prepared statement.

CommonPreparedStatement automatically converts columns to Dart objects based on their columnType and uses high-level types like lists to represent parameters and results.

In some cases, it may be more efficient to call the underlying sqlite3_ methods directly. This class provides methods mapping directly to raw SQLite C function calls, with no additional checks or implicit conversions.

Typically, this API would be used by:

  1. Calling bind methods to bind prepared statement parameters.
  2. While step returns true,
    • call columnType and other column methods to read values.
  3. Call CommonPreparedStatement.reset or CommonPreparedStatement.close.

On the web, this can also be used to bind JavaScript BigInt values to statements via WasmRawPreparedStatement.

None of these methods may be called after a statement is CommonPreparedStatement.closed. Unlike CommonPreparedStatement methods which validate that invariant, calling raw methods on finalized statements is an unchecked use-after-free.

on
  • StatementImplementation
Annotations
  • @experimental

Properties

columnCount int
Calls sqlite3_column_count, returning the amount of columns of this prepared statement.
no setter
debugParameters List<Object?>
A list of parameters used in SqliteException.parametersToStatement for exceptions thrown on this statement.
no getter
supportsColumnTableName bool
Whether the SQLite library supports extracting the table name information out of a column.
no setter

Methods

bindBlob(int index, List<int> value) → void
Calls sqlite3_bind_blob64 with the 1-based index and the target value.
bindDouble(int index, double value) → void
Calls sqlite3_bind_double with the 1-based index and the target value.
bindInt64(int index, int value) → void
Calls sqlite3_bind_int64 with the 1-based index and the target value.
bindNull(int index) → void
Calls sqlite3_bind_null with the 1-based index.
bindText(int index, String value) → void
Calls sqlite3_bind_text with the 1-based index and the target value.
columnBlob(int index) Uint8List
Calls sqlite3_column_blob with the given index.
columnDouble(int index) double
Calls sqlite3_column_double with the given index.
columnInt64(int index) int
Calls sqlite3_column_int64 with the given index.
columnName(int index) String
Calls sqlite3_column_name with the given index.
columnTableName(int index) String?
Calls sqlite3_column_table_name with the given index.
columnText(int index) String
Calls sqlite3_column_text with the given index.
columnType(int index) SqlType
Calls sqlite3_column_type, returning the type of a column.
step() bool
Calls sqlite3_step.