Skip to main content
Module

x/sqlite/docs/README.md

Deno SQLite module
Go to Latest
File

SQLite for Deno Documentation

test status docs status deno doc playground

This is the documentation for the Deno SQLite module. The module uses a version of SQLite compiled to WebAssembly to provide a JavaScript binding to SQLite.

Table of Contents

Runnable Example

import { DB } from "https://deno.land/x/sqlite/mod.ts";

// Open a database
const db = new DB("test.db");
db.query("CREATE TABLE IF NOT EXISTS people (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)");

const names = ["Peter Parker", "Clark Kent", "Bruce Wayne"];

// Run a simple query
for (const name of names)
  db.query("INSERT INTO people (name) VALUES (?)", [name]);

// Print out data in table
for (const [name] of db.query("SELECT name FROM people"))
  console.log(name);

// Close connection
db.close();