Ignored | Statements | Branches | Functions | Lines |
Statements: 1 Branches: 1 Functions: 0 |
100% (20 / 20) |
100% (5 / 5) |
100% (3 / 3) |
100% (20 / 20) |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | 2 2 2 2 2 1 1 1 1 1 1 1 10 10 1 1 10 1 10 1 | /* example.js this script will run node-demo of sqlite3-lite instruction 1. save this script as example.js 2. run shell-command: $ npm install sqlite3-lite && \ PORT=8081 node example.js 3. edit this script to suit your needs */ /* istanbul instrument in package sqlite3 */ /* jslint utility2:true */ /* istanbul ignore next */ // run shared js-env code - init-local (function () { "use strict"; let db; let sqlite3; sqlite3 = ( globalThis.utility2_rollup || globalThis.utility2_jslint || globalThis.utility2_moduleExports ); db = new sqlite3.Database(":memory:"); db.serialize(function () { let ii; let stmt; db.run("CREATE TABLE lorem (info TEXT)"); stmt = db.prepare("INSERT INTO lorem VALUES (?)"); ii = 0; while (ii < 10) { stmt.run("Ipsum " + ii); ii += 1; } stmt.finalize(); db.each("SELECT rowid AS id, info FROM lorem", function (err, row) { Iif (err) { throw err; } console.log(row.id + ": " + row.info); }); }); db.close(); }()); |