2
Well, I intend to check a table with nodejs, to see if it is without records.
How can I do this in a way that makes no mistake, with nodejs?
Thank you.
2
Well, I intend to check a table with nodejs, to see if it is without records.
How can I do this in a way that makes no mistake, with nodejs?
Thank you.
2
Checks the .length
of the result:
db.query('SELECT * from tabela', (err, res) => {
console.log(err, res, res.length); // deve dar null, [], 0
if (res.length == 0){
console.log('A tabela está vazia!');
}
});
Browser other questions tagged node.js
You are not signed in. Login or sign up in order to post.