Sqlite3 –
Small sqlite3 command wrapper with buffer and boolean support.
var sqlite3 = require("@litejs/sqlite3")
, db = sqlite3("./test.db", {
bin: "/bin/sqlite3", // Default: sqlite3
migration: "./db/test/" // Migration sql files. Default: null
nice: 1 // Default: null
})
// update db.real, db.user and db.sys for each query
db.run(".timer on")
// report a number of rows affected by INSERT, DELETE, or UPDATE statement
db.run(".changes on")
db.run("CREATE TABLE t1 (id INT PRIMARY KEY, enabled BLOB, val BLOB)")
db.run("INSERT INTO t1 VALUES (?, ?)", [1, true, "str"])
db.get("SELECT id, val FROM t1 WHERE t=?", [1], function(err, row) {
// row = { id: 1, val: 'str' }
})
db.close()
// allow the parent to exit without waiting for a child to exit
db.child.unref()
External links
Licence
Copyright (c) 2013-2020 Lauri Rooden <lauri@rooden.ee>
The MIT License