jensarps/IDBWrapper

Firefox DataError

Closed this issue · 2 comments

On latest firefox I get a 'DataError: Data provided to an operation does not meet requirements'.

var options = {
        dbVersion: 1,
        storePrefix   : myprefix-',
        storeName: 'settings',
        keyPath: 'id',
        autoIncrement : true,
        onStoreReady  : storeReadyFunc
};
idbs_settings = new IDBStore(options);

Later on I try a batch insert:

function saveSettings(options){
    var operations = [];
    for (var prop in options) {
        if (options.hasOwnProperty(prop)){
            var obj = {
                id: parseInt(prop),
                value: options[prop]
            };
            operations.push({
                type  : "put",
                value : obj
            });
        }
    }
    idbs_settings.batch(operations,function(result){
        _logger.log(result);
    });
}

This works on Chrome and IE10, still not tested on Safari.

Ok i got it working. When the db was created the first time had a slightly different structure, even incrementing the database version didn't help. Deleting the folder where firefox stocks the sqlite files did the trick. Sorry for the disturb

Glad that it worked out for you!

Just in case you run into such an issue again: You can also use the deleteDatabase() method, it works in Firefox, too – might be easier and quicker than searching for the files on disk.