Skip to main content
Module

x/sqlite/mod.ts>DB#execute

Deno SQLite module
Go to Latest
method DB.prototype.execute
import { DB } from "https://deno.land/x/sqlite@v3.7.2/mod.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