I trying to fetch some records from Sqlite db using Node JS.
我尝试使用Node JS从Sqlite db获取一些记录。
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('chat.db');
db.serialize(function(){
db.each("SELECT * FROM chats", function (err, row) {
io.emit('chats',row);
});
});
But this iterates the result set and send one at a time.How can I get the entire result set (without using another array) so that I can loop it somewhere else?
但是这会迭代结果集并一次发送一个。如何获得整个结果集(不使用其他数组)以便我可以将其循环到其他地方?
1 个解决方案
#1
2
I have now the same problem. Could be to late, but I solved it with another db-handler. It's called dblite: https://github.com/WebReflection/dblite With that you can get a complete result set for your query.
我现在有同样的问题。可能会迟到,但我用另一个db-handler解决了它。它被称为dblite:https://github.com/WebReflection/dblite使用它可以获得查询的完整结果集。
#1
2
I have now the same problem. Could be to late, but I solved it with another db-handler. It's called dblite: https://github.com/WebReflection/dblite With that you can get a complete result set for your query.
我现在有同样的问题。可能会迟到,但我用另一个db-handler解决了它。它被称为dblite:https://github.com/WebReflection/dblite使用它可以获得查询的完整结果集。