SQLite

sqlite. SQLite

new SQLite(urlOrPath, optsopt, optsopt)

SQLite main class.

Example
var { SQLite } = require("sigma/sqlite");
var db = new SQLite("file:./my.db", { timeoutMs: 2000, foreignKeys: true });
db.run("CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, name TEXT)");
var res = db.run("INSERT INTO test(name) VALUES(?)", ["Alice"]);
console.log(res.changes, res.lastInsertId);
Parameters:
Name Type Attributes Description
urlOrPath string

SQLite connection string or file path.

opts Object <optional>

Options: { readOnly?:boolean, timeoutMs?:number, foreignKeys?:boolean }
Examples:
- "jdbc:sqlite:/abs/path.db"
- "file:./test.db"
- "./test.db"

opts SQLiteOptions <optional>