lundi 27 juillet 2015

How to get entire result set in sqlite nodejs select query?

I trying to fetch some records from Sqlite db using Node JS.

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?

Aucun commentaire:

Enregistrer un commentaire