all

Bun

Symbol

Statement.all

all(...params: ParamsType): ReturnType[]

Execute the prepared statement and return all results as objects.

@param params

optional values to bind to the statement. If omitted, the statement is run with the last bound values or no parameters if there are none.

const stmt = db.prepare("SELECT * FROM foo WHERE bar = ?");

stmt.all("baz");
// => [{bar: "baz"}]

stmt.all();
// => []

stmt.all("foo");
// => [{bar: "foo"}]