Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,9 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
stmt.free();
}
if (typeof done === "function") {
return done();
done();
}
return undefined;
return this;
};

/** Prepare an SQL statement
Expand Down
2 changes: 2 additions & 0 deletions test/test_database.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ exports.test = function(SQL, assert, done) {
// Testing db.each
db.run("CREATE TABLE test (a,b); INSERT INTO test VALUES (1,'a'),(2,'b')");
var count = 0, finished = false;
var chained = db.each("SELECT * FROM test", function () {}, function () {});
assert.strictEqual(chained, db, "db.each returns the database object");
db.each("SELECT * FROM test ORDER BY a", function callback (row){
count++;
if (count === 1) assert.deepEqual(row, {a:1,b:'a'}, 'db.each returns the correct 1st row');
Expand Down