diff --git a/README.md b/README.md index 2238694..353658e 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,32 @@ The sqlite3 module provides a rich set of features: - Bundles SQLite as a fallback +See the API documentation: https://github.com/mapbox/node-sqlite3/wiki + + + Usage Example + +> +> 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(); +> + ## Quickstart