我想返回'mdp'变量,但是我在变量范围内遇到困难。我正在为该变量分配一个字符串,当我尝试返回它时,它说我的变量为空。
function getMdp() {
var mdp
connection.query('SELECT password FROM roompasswords WHERE meetingid = ? AND roomid = ? ', [meetingId, roomId], (err, rows) => {
if (err) throw log.info(err);
mdp = rows[0].password
});
return mdp
}