Skip to content

TableRunner.insertMany() method

Home > @direct-sqlite/core > TableRunner > insertMany

Packages arrays of similar records into a single multi-row insertion statement to minimize execution context switches.

Signature:

insertMany(records: Partial<TRow>[]): {
changes: number;
lastInsertRowid: number;
lastInsertRowId?: undefined;
} | {
changes: any;
lastInsertRowId: number;
lastInsertRowid?: undefined;
};

Parameter

Type

Description

records

Partial<TRow>[]

An array of objects, each containing the columns and their values to be inserted for a single row.

Returns:

{ changes: number; lastInsertRowid: number; lastInsertRowId?: undefined; } | { changes: any; lastInsertRowId: number; lastInsertRowid?: undefined; }

The result of the insert operation, which typically includes the number of changes made and the last inserted row ID. The exact structure of the result may depend on the underlying SQLite client being used.