I am trying to store files into a database using phonegap. I am getting an error that the window object does not support openDatabase. Can anyone give me a solution? All the documents I have read give the same syntax. Where am I going wrong?
storeInDB : function(csvBucketArr){
db = window.openDatabase("testDB" , "1.0", "testDB", 1000000);
db.transaction(app.setUp, app.errorHandler, app.dbReady);
console.log("DB ready!!");
},
setUp: function(tx){
tx.executeSql("create table if not exists fileLog(id INTEGER PRIMARY KEY AUTOINCREMENT, fileName TEXT UNIQUE, bucketName TEXT NOT NULL)");
},
errorHandler: function(e){
alert("ERROR :: " + e.message);
},
dbReady: function(csvBucketArr){
db.transaction(function(tx){
for(var i in csvBucketArr){
var fname = csvBucketArr[i].fileKey, bname = csvBucketsArr[i].bucketName;
tx.executeSql("insert into fileLog( fileName , bucketName) values (?,?)", [fname, bname]);
alert("In dbReady");
}
}, errorHandler, function(){alert("files added to the table");});
}
Aucun commentaire:
Enregistrer un commentaire