SQLite for Nativescript
    Preparing search index...

    Interface SQLiteQueryApi

    The query methods, shared by a database and by a transaction.

    interface SQLiteQueryApi {
        batch(
            statements: (string | BatchStatement | [string, SqliteParams?])[],
            options?: BatchOptions,
        ): Promise<BatchResult[]>;
        each(
            query: string,
            params: SqliteParams,
            callback: (error: Error, row: SqliteRow) => void,
            complete?: (error: Error, count: number) => void,
            options?: SqliteRequestOptions,
        ): Promise<number>;
        execute(query: string, params?: SqliteParams): Promise<ExecResult>;
        executeScript(script: string): Promise<void>;
        executeSync(query: string, params?: SqliteParams): ExecResult;
        get(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): Promise<SqliteRow>;
        getArray(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): Promise<any[]>;
        getArraySync(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): any[];
        getSync(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): SqliteRow;
        select(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): Promise<SqliteRow[]>;
        selectArray(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): Promise<any[][]>;
        selectArraySync(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): any[][];
        selectSync(
            query: string,
            params?: SqliteParams,
            options?: SqliteRequestOptions,
        ): SqliteRow[];
    }

    Hierarchy (View Summary)

    Index

    Methods

    • streams rows in chunks, resolves with the number of rows

      Parameters

      Returns Promise<number>

    • run several statements separated by ;, without parameters

      Parameters

      • script: string

      Returns Promise<void>

    • Blocking variants: they wait for the database thread on the calling thread, saving the event loop round trip for small statements in a loop, and block it for the whole statement. Node-API binding only (NativeScript >= 9.1).

      Parameters

      Returns ExecResult