1.0.1 • Published 5 years ago

cross-sqlcipher-promise v1.0.1

Weekly downloads
4
License
GPL-3.0
Repository
github
Last release
5 years ago

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();