Subj : SQLite
To   : All
From : John Dovey
Date : Fri Jun 11 2021 08:43 pm

I'm not sure if this is doable, so I was wondering if, before I dive down the rabbit-hole, someone else has some idea.
I want to write something and access some SQLite data from within the js. Something like this:
=Start=
 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();

=end=

Any suggestions?

Thanks
JD
---
* El Gato de Fuego (The Fire Cat) 4:920/69  * Pedasi, Panama

... HE has not a single redeeming defect.
---
� Synchronet � El Gato de Fuego - Pedasi, Panama - gatofueg.synchro.net