Skip to content

Instantly share code, notes, and snippets.

@dalelane
Created June 15, 2014 20:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalelane/77c08b3bc698499fde80 to your computer and use it in GitHub Desktop.
Save dalelane/77c08b3bc698499fde80 to your computer and use it in GitHub Desktop.
Node.js with an SQLite in-memory database (from https://github.com/mapbox/node-sqlite3)
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();
@jeancode
Copy link

hola que tal muy buen trabajo saludos al equipo, me gustaría saber como migrar una base e datos gurdada en :memory: porfavor me podrian ayudar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment