Asynchronous, non-blocking SQLite3 bindings for Node.js.
Extended version
Supported platforms
The sqlite3
module works with Node.js v4.x, v6.x, v8.x, and v10.x.
The sqlite3
module also works with node-webkit if node-webkit contains a supported version of Node.js engine. (See below.)
SQLite's SQLCipher extension is also supported. (See below.)
Usage
Note: the module must be installed before use.
var sqlite3 = ;var db = ':memory:'; db; db;
Custom functions
First implementation by Whitney Young
var sqlite3 = ; var db = ':memory:' { db; dball'SELECT A_PLUS_B(1, 2) AS val' { console; //Prints [{val: 3}] }; db; };
Custom aggregate
var sqlite3 = ; var db = ':memory:' { let tempStr = ''; db; dball'SELECT CUSTOM_AGGREGATE(id) AS val' { console; //Prints [{val: '123456'}] if table has 6 rows with id field }; db; };
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
- Bundles Sqlite3 3.15.0 as a fallback if the installing system doesn't include SQLite
- Custom functions. Implemented
sqlite_create_function
API
See the API documentation in the wiki.
Installing
You can use npm
to download and install:
- GitHub's
master
branch:npm install https://github.com/lailune/node-sqlite3/tarball/master
It is possible to use the installed package in node-webkit instead of the vanilla Node.js.
Testing
mocha is required to run unit tests.
In sqlite3's directory (where its package.json
resides) run the following:
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
- Whitney Young
- Andrey Nedobylsky
Acknowledgments
Originally developed by MapBox