SQLite

statement.all()

Materializes result rows in an array. Limit result sets before reading to avoid excessive memory use. The synchronous API can block the event loop; the 22.16.0 module is experimental. This fixture uses an isolated in-memory database. Tested on Node.js 22.16.0. Example output (one line per entry): ["1,2"].

Formal Syntax & Structure

nodejs syntaxnodejs
statement.all([namedParameters][, ...anonymousParameters])

Parameters & Attributes

NameTypeDescription
namedParametersobjectNamed bind values.
anonymousParametersunknown[]Positional bind values.

Return Value

object[]

Result rows.

Working Example

Example Snippetnodejs
import { DatabaseSync } from 'node:sqlite';const db = new DatabaseSync(':memory:');try {    db.exec('CREATE TABLE book(id INTEGER); INSERT INTO book VALUES (2),(1),(3)');    console.log(db.prepare('SELECT id FROM book ORDER BY id LIMIT ?').all(2).map(x => x.id).join(','));}finally {    db.close();}
Node.js Reference