I have some trouble understanding how function are used related to sql, I made a function (starting from a similar one) like this to know if db has records
function DbIsEmpty( results )
{
var len = results.rows.length;
console.log( len );
if(len==0) PopulateDB();
else return false;
}
So if it has no record it calls PopulateDB function, if has records return false.
Then, my problem is that I'd like better that I can use the function result in an if condition, but right now I'm using it like this
db.executeSql("SELECT * FROM Table;", [], DbIsEmpty);
So I don't know how can I use it in a condition. My enquiry is valid in this particular case but I wish to be able to create other functions usable inside the code like conditions, loops, etc.
Any help or documentation link will be much appreciated, thank you