This is the code. I tried exploring the options of SQL for solving this, but they are limited. I want to pass newSync[i].id to the onsuccess callback function, but I fail
tx.executeSql('SELECT * FROM bookmarks WHERE bookmarkID = ?', [newSync[i].id],
function(tx,results){
console.log('results.rows.item(0).bookmarkID', results.rows.item(0).bookmarkID);
tx.executeSql('UPDATE bookmarksSync SET thumbnail=?, ts_created=?, visits=?, visits_morning=?, visits_afternoon=?, visits_evening=?, visits_night=?, position=?, idgroup=? WHERE bookmarkID=?',
[results.rows.item(0).thumbnail, results.rows.item(0).ts_created, results.rows.item(0).visits, results.rows.item(0).visits_morning, results.rows.item(0).visits_afternoon, results.rows.item(0).visits_evening, results.rows.item(0).visits_night, results.rows.item(0).position, 0, newSync[i].id]],
null,speeddial.storage.onError)
}
, speeddial.storage.onError);
newSync[i].id appears to be undefined and I am pretty sure I have to pass it to the callback function, but I dont know how… Any ideas? I want to be able to pass the newSync[i].id and the results from the SQL selection to another function, which will update the WebSQL table.
I fail even if I add newSync[i].id as a third argument to function(tx,results)