jeudi 1 janvier 2015

Phonegap web sql database creation error: no such table: cacheGroups

I'm developing a mobile application using Phonegap. My app has a web sql database in it. The first time the app is launched the database is created and populated. Below the code that I am using for the database creation:



var db = window.openDatabase('littera', '1.0', 'Littera DB', 5 * 1024 * 1024);

db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS quote (id integer primary key, author_id integer, category text, content text, favourite integer)');
tx.executeSql('CREATE TABLE IF NOT EXISTS author (id integer primary key, name text, short_bio text, media text)');
callback();
}, function(e) {
console.log("ERROR CREATING DB: " + e.message);
callback();
});


The first time I launch the app the following error relative to the database creation happens (notice that this happens only the first time, the app works perfectly on all other launches):



01-01 23:57:41.600: E/SQLiteLog(1944): (1) no such table: CacheGroups
01-01 23:57:41.600: D/WebKit(1944): ERROR:
01-01 23:57:41.600: D/WebKit(1944): Application Cache Storage: failed to execute statement "DELETE FROM CacheGroups" error "no such table: CacheGroups"
01-01 23:57:41.600: D/WebKit(1944): external/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp(558) : bool WebCore::ApplicationCacheStorage::executeSQLCommand(const WTF::String&)
01-01 23:57:41.600: E/SQLiteLog(1944): (1) no such table: Caches
01-01 23:57:41.600: D/WebKit(1944): ERROR:
01-01 23:57:41.600: D/WebKit(1944): Application Cache Storage: failed to execute statement "DELETE FROM Caches" error "no such table: Caches"
01-01 23:57:41.600: D/WebKit(1944): external/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp(558) : bool WebCore::ApplicationCacheStorage::executeSQLCommand(const WTF::String&)
01-01 23:57:41.600: E/SQLiteLog(1944): (1) no such table: Origins
01-01 23:57:41.600: D/WebKit(1944): ERROR:
01-01 23:57:41.600: D/WebKit(1944): Application Cache Storage: failed to execute statement "DELETE FROM Origins" error "no such table: Origins"
01-01 23:57:41.600: D/WebKit(1944): external/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp(558) : bool WebCore::ApplicationCacheStorage::executeSQLCommand(const WTF::String&)
01-01 23:57:41.600: E/SQLiteLog(1944): (1) no such table: DeletedCacheResources


The tables that generate the errors are not my own tables, but some tables created by web sql behind the scenes to do his own magic. I suppose something goes wrong during the database creation, since I do not have the same mistakes on later launches. Am I missing something?


Aucun commentaire:

Enregistrer un commentaire