ISqliteStatement: {
    reader: boolean;
    all(parameters: readonly unknown[]): unknown[];
    iterate(
        parameters: readonly unknown[],
    ): IterableIterator<unknown, any, any>;
    run(
        parameters: readonly unknown[],
    ): { changes: number | bigint; lastInsertRowid: number | bigint };
}

Represents a prepared SQLite statement that can be executed with parameters. Provides three execution modes: fetching all results, running a mutation, or lazily iterating results one row at a time.

IMPORT_PATH: "@daiso-tech/core/utilities"

Type declaration

  • Readonlyreader: boolean

    Whether this statement is a read-only query (SELECT).

  • all:function
    • Executes the statement and returns all result rows as an array.

      Parameters

      • parameters: readonly unknown[]

        Positional bind parameters for the SQL statement.

      Returns unknown[]

      An array of row objects, or an empty array if no rows match.

  • iterate:function
    • Executes the statement and returns a lazy iterator over result rows. Useful for large result sets where loading all rows into memory at once is undesirable.

      Parameters

      • parameters: readonly unknown[]

        Positional bind parameters for the SQL statement.

      Returns IterableIterator<unknown, any, any>

      A lazy iterator that yields one row at a time.

  • run:function
    • Executes a mutation statement (INSERT, UPDATE, DELETE) and returns metadata.

      Parameters

      • parameters: readonly unknown[]

        Positional bind parameters for the SQL statement.

      Returns { changes: number | bigint; lastInsertRowid: number | bigint }

      An object with the number of rows affected and the last inserted row ID.

      • changes: number | bigint

        Number of rows affected by the statement.

      • lastInsertRowid: number | bigint

        Row ID of the last inserted row. 0 if no row was inserted.