SQLitePool

sqlite. SQLitePool

new SQLitePool(urlOrPath, optsopt, numReadersopt)

SQLite connection pool (1 writer + N readers)

Example
var { SQLitePool } = require("sigma/sqlite");
var pool = new SQLitePool("./pool.db", { readers: 2, wal: true });
pool.withWriter(db => db.run("INSERT INTO t(name) VALUES(?)", ["pool"]));
var rows = pool.withReader(db => db.all("SELECT * FROM t"));
print(JSON.stringify(rows));
pool.close();
Parameters:
Name Type Attributes Description
urlOrPath string

Database path or JDBC/URI

opts Object <optional>
Properties
Name Type Attributes Default Description
readers number <optional>
2

Number of reader connections

wal boolean <optional>
false

Enable WAL on writer after open

numReaders number <optional>

(Deprecated) use opts.readers instead