Safari shows indexed column undefined on indexeddb polyfill. How to retrieve data using indexes in safari

637 views Asked by At

I m getting the index colums on safari as undefined

enter image description here Here is the snippet i ve written.

I am using parshurams indexeddb and shim jquery plugin.

.indexedDB("database_name", { 
    "schema" :
        "1" : function(transaction){
            // Examples of using the transaction object
            var obj2 = transaction.createObjectStore("store2",{"keyPath":"index"});
            obj2.createIndex("price");
        }
    }
});
var sampledata={
      index:'1',
      firstName: 'Aaron',
      lastName: 'Powell',
      answer: 42,
      price:100
  };
var randomnumber=Math.floor(Math.random()*1155)
var objectStore = $.indexedDB("database_name").objectStore("store2");
var promise = objectStore.add(sampledata);
1

There are 1 answers

3
Kyaw Tun On

This question is not related to YDN-DB library, however I have look though parshurams polyfill and facebook polyfill. You will get better off with facebook polyfill due to its extensive testing and better key encoding.

Both polyfill will slower than YDN-DB when using secondary key (index). This is because these polyfill use table for each (primary and secondary) key, whereas YDN-DB is one table for each store, (except for multiEntry key, which require separate relationship table). Performance can dramatically differ, say 10x or 100x, for index base batch query, since YDN-DB will use SQL query where as polyfills will iterate using multiple OFFSET query requests to emulate cursor walk.