Reputation: 333
i have a problem with worker and database on phonegap
my main.js open database and perform staff(create table , insert data), it's work fine , in main.js i call a worker
in worker.js i must use my database so i do
db = openDatabase('kpi', '1.0', 'dashboard kpi', 5 * 1024 * 1024);
I do that because i can't passe object database to my worker.
when i run my code i have this error :
[Error] unable to open database, version mismatch, '1.0' does not match the currentVersion of ''
i don't understand why it does not want open my database in my worker, i have not change my database version ....
Upvotes: 2
Views: 920
Reputation: 333
var worker=new Worker("js/uga_db_worker.js");
worker.postMessage(ugaName);
worker.onmessage=function(event){
}
};
it my call in main.js
i have find a fix, if in my worker i do not use a number version for opendatabase, all is working
db = openDatabase('kpisselencro', '', 'dashboard kpisselincro', 5 * 1024 * 1024);
the version number is empty, i don't know why , but it seem really fix it.
Upvotes: 1
Reputation: 512
How your are calling worker.js in inside main.js , opendatabase method will not have any problem if you are defining in different js.
Can you please provide code snippet how you are calling this ?
Upvotes: 0