Skip to content

Instantly share code, notes, and snippets.

@mridgway
Created October 9, 2012 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mridgway/3861846 to your computer and use it in GitHub Desktop.
Save mridgway/3861846 to your computer and use it in GitHub Desktop.
var async = require('async');
mysqlConnection.query(queryString, function selectCb(error, results, fields) {
var subQueryFns = [];
for (i=0; results.length; i++) {
subQueryFns.push(function (cb) {
mysqlConnection.query(deeperQueryString, function selectCb (error, results, fields) {
cb(error, results);
}
});
}
async.parallel(subQueryFns, function (error, results) {
console.log(results); // this will contain an array of the results from each subquery's cb call
callback(null, results);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment