npm.io
1.0.1 • Published 8 years ago

cross-sqlcipher-promise

Licence
GPL-3.0
Version
1.0.1
Deps
1
Size
4 kB
Vulns
0
Weekly
0

Promise wrapper around cross-sqlcipher

Wraps cross-sqlcipher with promises.

Install

npm install cross-sqlcipher-promise

Usage Example

var sqlite3 = require("cross-sqlcipher-promise")
var db = new sqlite3.Database("test.db")

db.serialize()
db.run("PRAGMA KEY = 'secret'").then( ()=> {
    return db.get("SELECT author FROM books WHERE rowid<10")
}).then(row => {
    console.log(row.name)
})

db.prepare("INSERT INTO books VALUES(author,title)",["Me","How to Code"])
  .then(stmt=>stmt.run())
  .then(stmt=>{
    var rowid_Integer = stmt.lastID
    stmt.finalize()
    return rowid_Integer
  })

db.close();