我试图弄清楚如何在nodejs中使用最少的处理能力来运行多个查询(此nodejs应用程序正在平板电脑中运行而没有大量内存)。
以下是情况(问题在第二个if语句之下):
connection.query("SELECT hashtag from user_information", function(err, rows, fields) {
if (!err) {
// Check to see if the user entered hashtag is found in the database
// Create a variable to track if the item was found
var wasFound = false;
for(var i=0; i< rows.length; i++) {
if (rows[i].hashtag == userEnteredHashtag) {
res.render('delivery/chooseBox', {
box_id: 'Box11',
// Run a second query from box table and grab all of the `longestDimension` of Box11 such as it will come out as 11, 18, 24, etc. and store those numbers in the longestDimension key (increment each instance for example
longestDimension1: '11',
longestDimension2: '18',
longestDimension3: '24',
)
});
// Change the variable to true
wasFound = true;
//console.log(packageIdDatabase + 10);
}
}
基本上,我想从box表中运行第二个查询并获取box_id的所有longestDimension
,例如它将显示为11,18,24,然后将这些值存储在longestDImension键中