Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/sqlite/mod.ts>DB#execute

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