Return Executesql Function
I'm trying to return the results of a SQL query using SQLite. The query works fine and I can output the results inside the executeSql function. But when I try to reach the array fr
Solution 1:
It's an async issue. db.transaction takes a callback which executes after the sqlite transaction finishes. Your console.log() statement shown at the end of your method is actually happening before result has been populated. 
EDIT ADDITION:
functions getPersons() {
  returnSQLArray('SELECT * FROM PERSONS', processPersonsResponse); 
}
function returnSQLArray(str, callback) {
  ...
  tx.executeSql(str, [], function(tx, rs) { callback(result); });
}
function processPersonsResponse(response) {
  //do work with response
}
Post a Comment for "Return Executesql Function"