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 } |
opts |
SQLiteOptions |
<optional> |