I've got the following function on my client-side db:
dropTable = function (a, tbl) {
a.executeSql('Drop Table If Exists ' + tbl + ';', [],
function(a, b){
console.log('Table "' + tbl + '" dropped.');
}
, errorHandler);
};
What do I have to do to show the console message only when a table is dropped? It currently shows on every function call.
Looks like your query is "successful" whether it exists or not (since you guard for the case of nonexistence). If you want to fail hard:
dropTable = function (a, tbl) {
a.executeSql('Drop Table ' + tbl + ';', [],
function(a, b){
console.log('Table "' + tbl + '" dropped.');
}
, errorHandler);
};
This should call the errorHandler if it doesn't exist. Cheers!