From e5a24fdf41f1fa31d7b0496398146f84118927ac Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 13 Apr 2022 15:02:39 +0100 Subject: [PATCH] Deleted `examples/` folder - for the most part, it's a clone of the Usage section in the README and I don't think the differences are important enough that we need another file to maintain and look after - perhaps in the future we can build up a full set of examples that are cared for --- examples/simple-chaining.js | 50 ------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 examples/simple-chaining.js diff --git a/examples/simple-chaining.js b/examples/simple-chaining.js deleted file mode 100644 index 17a78785b..000000000 --- a/examples/simple-chaining.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Shows how to use chaining rather than the `serialize` method. - */ -"use strict"; - -var sqlite3 = require('sqlite3').verbose(); -var db; - -function createDb() { - console.log("createDb chain"); - db = new sqlite3.Database('chain.sqlite3', createTable); -} - - -function createTable() { - console.log("createTable lorem"); - db.run("CREATE TABLE IF NOT EXISTS lorem (info TEXT)", insertRows); -} - -function insertRows() { - console.log("insertRows Ipsum i"); - var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); - - for (var i = 0; i < 10; i++) { - stmt.run("Ipsum " + i); - } - - stmt.finalize(readAllRows); -} - -function readAllRows() { - console.log("readAllRows lorem"); - db.all("SELECT rowid AS id, info FROM lorem", function(err, rows) { - rows.forEach(function (row) { - console.log(row.id + ": " + row.info); - }); - closeDb(); - }); -} - -function closeDb() { - console.log("closeDb"); - db.close(); -} - -function runChainExample() { - createDb(); -} - -runChainExample();