Currently I am using node-mysql (https://github.com/felixge/node-mysql) and for each result it returns from the database I have to perform several functions. Currently, it attempts to complete everything at once, however is there anyway to make it wait until each function is complete before moving to the next result from mysql?
connection.query('select * from data', function(err, rows) {
for (var i = 0; i < rows.length; i++) {
doThis(rows[i].axn, rows[i].dnq, rows[i].bgq);
}
});
In the doThis function, if certain requirements are met than it passes the data to another function. How can I make sure that those are completed first before moving until the next query row?
Thank you in advance!