[Q] Market update deletes the stored data

Search This thread

badcoke.com

New member
Apr 2, 2014
2
0
I made an phonegap app, which is using websql for storing data. Everything works fine, it is on Google Play. The problem is when I update it (from the market) it erases all of the data which is stored in the websql. My question is, how can I solve this problem? How can I solve it, not to erase all of the data, when I update is?
 

Archer

Inactive Recognized Developer / Retired Senior Mod
Jul 9, 2008
14,002
4,003
Manchester
Google Pixel 8 Pro
I made an phonegap app, which is using websql for storing data. Everything works fine, it is on Google Play. The problem is when I update it (from the market) it erases all of the data which is stored in the websql. My question is, how can I solve this problem? How can I solve it, not to erase all of the data, when I update is?

The data associated with the app should only be deleted when you either uninstall the app or delete it manually (of course). Do you have anything in your code that initialises the database? I assume you create a database & table structure somewhere - are you sure you're not running that again?
 
Last edited:

badcoke.com

New member
Apr 2, 2014
2
0
The data associated with the app should only be deleted when you either uninstall the app or delete it manually (of course). Do you have anything in your code that initialises the database? I assume you create a database & table structure somewhere - are you sure you're not running that again?

I am sure, that that the database is not running again.
Here is my code:


Code:
function databaseFunction () {
var db,
len,
bx,
res = [];

this.open = function(levelDone) {
db = openDatabase('worderDd', '1.0', 'Test DB', 5 * 1024 * 1024);
var msg;
}

this.create = function() {
db.transaction(function (tx) {
  tx.executeSql('CREATE TABLE IF NOT EXISTS worderDd (id INTEGER PRIMARY KEY AUTOINCREMENT, level)');
});
} 

this.addData = function (levelDone) {
db.transaction(function (tx) {
  tx.executeSql('INSERT INTO worderDd (level) VALUES (?)', [levelDone]);
  
    alert('AWWWWWWESOME! LEVEL COMPLETED');
window.location.replace("index.html");
});

}


Unfortunately the stored data is missing from this section of the code when update it through the market :(