I am not able to return value in the function, I know it is wrong, but I have tried several times without success. The query is being performed and brings the password, the problem is to return this value to whoever ran the function:
function obtemSenha() {
var read_R = 'select * from senha';
var ret = 0;
connect.getConnection(function(err, connection){
connection.query(read_R, function(err, data, fields){
if(err) throw err;
else {
console.log('SenhaREC....0: ${data[0].senha}');
ret = data[0].senha;
connection.release();
}
});
});
return ret;
};
var senha = obtemSenha();