Created
October 9, 2012 22:28
-
-
Save mridgway/3861846 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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