I’m working an android application that is wrapped using phonegap and I’m using its Storage API. How can I pass an argument on my Sqlite Query to get a specific row? Thanks in advance. Below is my script. Can you provide me an example? Thanks
$(document).ready(function() {
code = 1;
var db = window.openDatabase("DEMO", "1.0", "DEMOX", 20000000 ); // 20MB in quuota storage size
db.transaction(function(){ queryDB(code) }, errorCB, querySuccess);
function querySuccess(tx, results) {
console.log("Returned rows = " + results.rows.length);
// this will be true since it was a select statement and so rowsAffected was 0
if (!resultSet.rowsAffected) {
alert('No rows affected!');
return false;
}
}
function queryDB(tx, code) {
tx.executeSql('SELECT * FROM table WHERE code = ?', [code], querySuccess, errorCB);
}
function errorCB(err) {
console.log("Error processing SQL: "+err.code);
}
});
My solution : hope this will help others.