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
|
|||||||||||||||
numReaders |
number |
<optional> |
(Deprecated) use opts.readers instead |