You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Eugene Bulkin 0dcd6cdbff Update package.json 6 years ago
lib Export the Database class for alternate initialization 6 years ago
test Minor test fixes and bind() method 7 years ago
.gitignore Initial commit; support createDatabase, close, run, and get 7 years ago
.jshintrc Basic statement functionality (run, get, prepare, finalize) 7 years ago
.travis.yml Update readme, add license, prepare for first release 7 years ago
.yo-rc.json Initial commit; support createDatabase, close, run, and get 7 years ago
Gruntfile.js Complete rewrite for purpose of cleaner running of promises using wrapper rather than q-sqlite module itself. 7 years ago
LICENSE Update readme, add license, prepare for first release 7 years ago
README.md Update README.md 7 years ago
package.json Update package.json 6 years ago

README.md

q-sqlite3 Build Status npm module badge

npm stats

The node-sqlite3 module wrapped with Q promises.

Getting Started

Install the module with: npm install q-sqlite3

Documentation

The API is functionally the same as node-sqlite3's API. The API methods supported can be found on the wiki.

These all run as promises. If the normal API would not call the callback with data, then the promise resolves to the database.

The only new method is createDatabase, which serves as a promise-wrapped version of the Database constructor; if successful, the promise resolves to the database instance. Otherwise the promise is rejected with the error sent as in node-sqlite3.

Examples

var QSQL = require('q-sqlite3');
var DB = null;

QSQL.createDatabase(':memory:').done(function(db) {
  DB = db;
});

DB.run('INSERT INTO tbl (name) VALUES (?)', "foo").then(function(statement) {
  // do stuff with statement here
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • v0.0.1 - Initial release, only supports 3 basic query functions.
  • v0.0.2 - Second release, add exec function.
  • v0.1.0 - Restructuring release. Methods are now exposed as they were in sqlite3, as part of a Database or Statement object.
  • v0.1.1 - Implement the basics of Statements.
  • v0.1.2 - Extend Statement methods.

License

Copyright (c) 2014 Eugene Bulkin. Licensed under the MIT license.