axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 71 forks source link

shim behaviour on device vs emulator #40

Closed doonmcgill closed 11 years ago

doonmcgill commented 11 years ago

I've loaded the indexeddb shim in my (under dev) app and am getting a strange error on the device, whereas in the emulator it works fine. The app opens up a pouchdb database when it starts... On the device it gives me this error:

I/Web Console(): {"USEPOUCH:":true,"PROTOCOL":"idb://","SERVERURL:":"http://192.168.0.24:5986/","TEST:":true,"isChrome":false}:474
I/Web Console(): startup:Fetching databases:488
E/SQLiteLog(): (1) statement aborts at 2: [VACUUM;] cannot VACUUM - SQL statements in progress
E/Web Console(): Uncaught Error: NOT_FOUND_ERR: DOM IDBDatabase Exception 3:3690

On the emulator I get:

I/Web Console(): {"USEPOUCH:":true,"PROTOCOL":"idb://","SERVERURL:":"http://192.168.0.24:5986/","TEST:":true,"isChrome":false} at file:///android_asset/www/test.js:474
I/Web Console(): startup:Fetching databases at file:///android_asset/www/test.js:488
D/CordovaLog(): DroidGap:  onExceededDatabaseQuota estimatedSize: 4194304  currentQuota: 4194304  totalUsedQuota: 4194304
D/CordovaLog(): calling quotaUpdater.updateQuota newQuota: 4194304
I/Web Console(): Waiting for to be ready at file:///android_asset/www/jqm/IndexedDBShim.min.js:2
I/Web Console(): Waiting for to be ready at file:///android_asset/www/jqm/IndexedDBShim.min.js:2
I/Web Console(): CREATE TABLE 'document-store' (key BLOB PRIMARY KEY , value BLOB) at file:///android_asset/www/jqm/IndexedDBShim.min.js:2
...

and everything proceeds normally...

First thoughts were that it seems to be related to loading order of the scripts, but I've tried all sorts of combinations - currently I'm lazy loading (based on your example) cordova, indexedDB shim, pouchdb and my script in that order, with various time delays between. Also setting the window.shimIndexedDB variables... I know the scripts are loading correctly (and in the right order) because I'm sending various messages to the screen during startup.
Is there some fundamental incompatibility between the device and indexedDB or is it something that I'm doing wrong? The device is a Samsung Galaxy Note 2 with 4.1.2 and my manifest has minversion=maxversion=4.1.2..other info: cordova 2.7.0, pouchdb nightly (20130610),

Any suggestions what I might be doing wrong?

axemclion commented 11 years ago

Not sure how this is related to jquery-indexedDB plugin. Looks like this is related to PouchDB and the IndexedDB Shim. With pouchDB supporting WebSQL, you do not have to use the IndexedDBSHim anymore. Can you try just with the latest version on pouchDB ? If you still have problems, can you ask this in the pouchDB forum ?

doonmcgill commented 11 years ago

Sorry - I put it in the wrong place - it should have been the indexedDB shim. I'm having a problem with the websql implementation - for some reason the images are being truncated  (I've raised it with pouchdb team) - so I have to one or the other working in order to progress...


From: Parashuram N notifications@github.com To: axemclion/jquery-indexeddb jquery-indexeddb@noreply.github.com Cc: doonmcgill doonmcgill@yahoo.com Sent: Thursday, 13 June 2013 2:57 PM Subject: Re: [jquery-indexeddb] shim behaviour on device vs emulator (#40)

Not sure how this is related to jquery-indexedDB plugin. Looks like this is related to PouchDB and the IndexedDB Shim. With pouchDB supporting WebSQL, you do not have to use the IndexedDBSHim anymore. Can you try just with the latest version on pouchDB ? If you still have problems, can you ask this in the pouchDB forum ? — Reply to this email directly or view it on GitHub.

doonmcgill commented 11 years ago

FYI - the problem has been fixed by changing to "var indexedDB = window.shimIndexedDB||..." in the pouchdb code - no problems so far works well.