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

醉酒当歌 提交于 2019-12-23 03:17:48

问题


I m getting the index colums on safari as undefined

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:


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.



来源:https://stackoverflow.com/questions/20629010/safari-shows-indexed-column-undefined-on-indexeddb-polyfill-how-to-retrieve-dat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!