Skip to main content
node__sqlite.d.ts - Node documentation

Usage in Deno

```typescript import * as mod from "node:node__sqlite.d.ts"; ```
> [!WARNING] Deno compatibility > This module is not implemented. The `node:sqlite` module facilitates working with SQLite databases. To access it: ```js import sqlite from 'node:sqlite'; ``` This module is only available under the `node:` scheme. The following will not work: ```js import sqlite from 'node:sqlite'; ``` The following example shows the basic usage of the `node:sqlite` module to open an in-memory database, write data to the database, and then read the data back. ```js import { DatabaseSync } from 'node:sqlite'; const database = new DatabaseSync(':memory:'); // Execute SQL statements from strings. database.exec(` CREATE TABLE data( key INTEGER PRIMARY KEY, value TEXT ) STRICT `); // Create a prepared statement to insert data into the database. const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); // Execute the prepared statement with bound values. insert.run(1, 'hello'); insert.run(2, 'world'); // Create a prepared statement to read data from the database. const query = database.prepare('SELECT * FROM data ORDER BY key'); // Execute the prepared statement and log the result set. console.log(query.all()); // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ] ```

Classes

c
DatabaseSync
> [!WARNING] Deno compatibility > This module is not implemented. This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs exposed by this class execute synchronously.
c
StatementSync
> [!WARNING] Deno compatibility > This module is not implemented. This class represents a single [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This class cannot be instantiated via its constructor. Instead, instances are created via the`database.prepare()` method. All APIs exposed by this class execute synchronously. A prepared statement is an efficient binary representation of the SQL used to create it. Prepared statements are parameterizable, and can be invoked multiple times with different bound values. Parameters also offer protection against [SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks. For these reasons, prepared statements are preferred over hand-crafted SQL strings when handling user input.

Interfaces

I
DatabaseSyncOptions
> [!WARNING] Deno compatibility > This module is not implemented.
I
StatementResultingChanges
> [!WARNING] Deno compatibility > This module is not implemented.

Type Aliases

T
SupportedValueType
> [!WARNING] Deno compatibility > This module is not implemented.