Skip to main content
Go to Latest
method PreparedQuery.prototype.all
import { PreparedQuery } from "https://deno.land/x/sqlite@v3.7.2/mod.ts";

Binds the given parameters to the query and returns an array containing all resulting rows.

Examples

const query = db.prepareQuery<[number, string]>("SELECT id, name FROM people");
const rows = query.all();
// rows = [[1, "Peter"], ...]

To avoid SQL injection, user-provided values should always be passed to the database through a query parameter.

const query = db.prepareQuery("SELECT id FROM people WHERE name = ?");
query.all([name]);
const query = db.prepareQuery("SELECT id FROM people WHERE name = :name");
query.all({ name });

See QueryParameterSet for documentation on how values can be bound to SQL statements.

See QueryParameter for documentation on how values are returned from the database.

Parameters

optional
params: P

Returns

Array<R>