import { Database } from "https://deno.land/x/sqlite3@0.6.0/src/database.ts";
Creates a new Prepared Statement from the given SQL statement.
Example:
const stmt = db.prepare("SELECT * FROM mytable WHERE id = ?");
for (const row of stmt.all(1)) {
console.log(row);
}
Bind parameters can be either provided as an array of values, or as an object mapping the parameter name to the value.
Example:
const stmt = db.prepare("SELECT * FROM mytable WHERE id = ?");
const row = stmt.get(1);
// or
const stmt = db.prepare("SELECT * FROM mytable WHERE id = :id");
const row = stmt.get({ id: 1 });
Statements are automatically freed once GC catches them, however
you can also manually free using finalize
method.