Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sqlite3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
node-sqlite3
Commits
96e47968
Commit
96e47968
authored
Mar 17, 2010
by
Orlando Vazquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update README
parent
7b1623f3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
9 deletions
+81
-9
README
README
+81
-9
No files found.
README
View file @
96e47968
SQLite3 bindings for Node.js
=============================
NAME
----
Documentation lives at http://grumdrig.com/node-sqlite/
The code lives at http://github.com/grumdrig/node-sqlite/
node-sqlite - Asynchronous SQLite3 driver for Node.js
The two files required to use these bindings are sqlite.js and
build/default/sqlite3_bindings.node. Put this directory in your
NODE_PATH or copy those two files where you need them.
SYNOPSIS
--------
Tested with Node version v0.1.25-15-g4e16e38
var sys = require('sys'),
sqlite = require('./sqlite');
(c) 2010 Eric Fredricksen - See permissive license terms at top of sqlite.js
var db = new sqlite.Database();
// open the database for reading if file exists
// create new database file if not
db.open("lilponies.db", function () {
var colour = 'pink';
var sql = 'SELECT name FROM ponies WHERE tail_colour = ?';
// bindings list is optional
var ponies = [];
db.query(sql, [colour], function (pony) {
if (!pony) {
// no more ponies
if (!ponies.length)
sys.puts('There are no ponies with ' + colour + ' tails. :(');
else
sys.puts('The following ponies have ' + colour + ' tails: ' + ponies.join(', '));
}
sys.puts(sys.inspect(pony));
ponies.push(pony);
});
});
DESCRIPTION
-----------
This distribution includes two SQLite version 3 drivers: a low level driver
written in C++ and a high level driver. The latter wraps the former to add
nicer API and per-database query queuing to ensure queries do not clobber each
other.
It's HTML5 WebDatabase'ish but much, much simpler.
At the moment, this library is the bare minimum necessary to get results out
of SQLite, but extending either driver should be quite straight forward.
This SQLite interface is incompatible with verison 2.
SQLite's synchronous nature is fundamentally incompatible with a non-blocking
system such as Node. To get around this synchronous calls happen within Node's
libeio thread-pool, in a similar manner to how POSIX calls are currently made.
This is exposed to JavaScript in the form of Database and Statement objects.
The author is aware that SQLite ships with an asynchronous interface. This
interface however lacks the necessariy notification mechanism to alert the
caller when the SQLite call has completed. In other words, to be able to
support callbacks, we use the synchronous driver within a seperate thread.
SEE ALSO
--------
* http://sqlite.org/docs.html
* http://github.com/grumdrig/node-sqlite/
AUTHOR
------
Orlando Vazquez [ovazquez@gmail.com]
THANKS
------
Many thanks to Eric Fredricksen for his synchronous driver on which this was
based.
http://github.com/grumdrig/node-sqlite/
http://grumdrig.com/node-sqlite/
(c) 2010 Eric Fredricksen
(c) 2010 Orlando Vazquez
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment