I have implemented a Phonegap application for iPhone using jQuery mobile. I have created a database using sqlite.
I have created my own data base 0000000001.db with some list of tables.
added it in to resources folder of xcode proj,
and preloaded this data base in to the application in to the WebKit folder.
when i cheack using sqlite manage it show all my data base tables and the content in the tables. But i want to show that content in the list views (table views)
I preloded the data base by following the Gaurav S Tomar™ Tutorial Link.
I dont know what are the next steps for data driven from the sqlite data base
Now I want to retrieve the data from the database tables and populate it in to list views (table views).
i was very new to the phone gap applications,
I dont know were (in wich files) we implement the code to retrieve data from data base from my sqlite file 000001.db
and how to display /populate that retrieved data base in list views
Any detailed suggestions / tutorials please? Thanks in advance..
I have added a .js file main.js in that i have implementedm
function queryDB(sql) {
dbmanager.connect_database();
dbmanager.db.transaction(function(tx){
tx.executeSql(sql,[],getResult,dbmanager.errorCB);
},dbmanager.errorCB);
}
function getResult(tx,results)
{
for(var i=0;i<results.rows.length;i++){
console.log(results.rows);
console.log(results.rows.item[i]);
}
}
$(document).ready(function()
{
$('#OneView').click(function()
{
queryDB('select * from table');
});
});
in that console.log(results.rows); prints like : {"length":3}
console.log(results.rows.item[i]); prints TypeError: Result of expression 'message' [undefined] is not an object.
But not the column values i have added in the table
use http://docs.phonegap.com/en/1.7.0/cordova_storage_storage.md.html#SQLResultSet