I have mobile app written in HTML5 using PhoneGap. Some parts of the app make use of SQL database, like this:
db = window.openDatabase("my_app_database", "1.0", "Description of my database about 50 chars long", 1000000);
$.get('db/app_data.dat',function(result){
var data = $.parseJSON(result);
if (!data) {
alert('Data error');
return false;
}
db.transaction(function(tx){
tx.executeSql('DROP TABLE IF EXISTS table_a');
tx.executeSql('DROP TABLE IF EXISTS table_b');
tx.executeSql('CREATE TABLE table_a (id INTEGER,name,html)');
tx.executeSql('CREATE TABLE table_b (id_a INTEGER, id_b INTEGER)');
});
db.transaction(function(tx){
$.each(data.item, function(i, v){
tx.executeSql('INSERT INTO table_a(id, name,html) VALUES (?,?,?)',[v.id, v.name, v.html]);
});
});
});
On Android this works perfectly fine with no problem. But on iPhone(4.0, 4.2) it doesn't work at all. Do you have any ideas why this standard use of SQL database on PhoneGap would cause any kind of trouble on iPhone ? Are there some limits to be aware of ? E.g. database name limit, database size limit or query limits ?
EDIT: Don't know if it is relevant, but I am using PhoneGap v. 0.9.5.1 in this app right now.
SQLiteDatabase.OPEN_READWRITE? I mean do you have priviledges to write, did you make sure you can connect to the database?