Skip to main content
Module

x/sqlite/src/db.ts>DB#execute

Deno SQLite module
Latest
method DB.prototype.execute
import { DB } from "https://deno.land/x/sqlite@v3.9.0/src/db.ts";

Run multiple semicolon-separated statements from a single string.

This method cannot bind any query parameters, and any result rows are discarded. It is only for running a chunk of raw SQL; for example, to initialize a database.

Example

db.execute(`
  CREATE TABLE people (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT,
    age REAL,
    city TEXT
  );
  INSERT INTO people (name, age, city) VALUES ('Peter Parker', 21, 'nyc');
`);

Parameters

sql: string