Package Exports
- sqlite3
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sqlite3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NAME
node-sqlite3 - Asynchronous, non-blocking SQLite3 bindings for node.js 0.2-0.4 (versions 2.0.x), 0.6.13+, 0.8.x, and 0.10.x (versions 2.1.x).
USAGE
Install with npm install sqlite3
.
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(':memory:');
db.serialize(function() {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) {
console.log(row.id + ": " + row.info);
});
});
db.close();
FEATURES
- Straightforward query and parameter binding interface
- Full Buffer/Blob support
- Extensive debugging support
- Query serialization API
- Extension support
- Big test suite
- Written in modern C++ and tested for memory leaks
API
See the API documentation in the wiki.
BUILDING
Unless building via npm install
you will need node-gyp
installed globally:
npm install node-gyp -g
The module depends only on libsqlite3. However, by default, an internal/bundled copy of sqlite will be build and linked, so an externally installed sqlite3 is not required.
If you wish to install against an external sqlite then you need to pass the --sqlite
argument to node-gyp. You can do this like:
./configure --sqlite=/usr/local
make
Or like this (using the node-gyp built into npm):
node-gyp --sqlite=/usr/local
make
If building against an external sqlite3 make sure to have the development headers available. Mac OS X ships with these by default. If you don't have them installed, install the -dev
package with your package manager, e.g. apt-get install libsqlite3-dev
for Debian/Ubuntu. Make sure that you have at least libsqlite3
>= 3.6.
Note, if building against homebrew-installed sqlite on OS X you can do:
./configure --sqlite=/usr/local/opt/sqlite/
make
To obtain and build the bindings:
git clone git://github.com/developmentseed/node-sqlite3.git
cd node-sqlite3
npm install
You can also use npm
to download and install them:
npm install sqlite3
TESTS
mocha is required to run unit tests.
npm install mocha
npm test
CONTRIBUTORS
- Konstantin Käfer
- Dane Springmeyer
- Will White
- Orlando Vazquez
- Artem Kustikov
- Eric Fredricksen
- John Wright
- Ryan Dahl
- Tom MacWright
- Carter Thaxton
- Audrius Kažukauskas
- Johannes Schauer
- Mithgol
ACKNOWLEDGEMENTS
Thanks to Orlando Vazquez, Eric Fredricksen and Ryan Dahl for their SQLite bindings for node, and to mraleph on Freenode's #v8 for answering questions.
Development of this module is sponsored by Development Seed.
LICENSE
node-sqlite3
is BSD licensed.