developmentseed/node-sqlite3 — Issue #46: Database#prepareSet(object, cb) - prepare a set of statements
Author: networkimprov
Created: 2011-11-03 08:22:41+00:00
State: open

Would you accept a patch for a Database.prototype.prepareSet() method which takes an object containing strings of SQL and creates a Statement object for each, replacing the original string with the new object? Written in JS for the original sqlite binding, it looks like:

sqlite.Database.prototype.prepareSet = function(ioSet, iCallback, _async) {
var that = this;
for (var a in ioSet) {
if (typeof ioSet[a] !== 'string')
continue;
that.prepare(ioSet[a], function(err, stmt) {
if (err) return iCallback(err);
ioSet[a] = stmt;
that.prepareSet(ioSet, iCallback, 1);
});
return;
}
if (!_async)
process.nextTick(iCallback);
else
iCallback();
};