问题描述
我在safari上获得未定义的索引列
I m getting the index colums on safari as undefined
这是我写的摘录.
我正在使用parshurams indexeddb和shim jquery插件.
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);
推荐答案
这个问题与YDN-DB库无关,但是我看过parshurams polyfill和facebook polyfill.由于它具有广泛的测试和更好的密钥编码,因此使用facebook polyfill将使您受益匪浅.
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.
使用辅助键(索引)时,两个polyfill都将比YDN-DB慢.这是因为这些polyfill用于每个(主键和辅助键)表,而YDN-DB是每个商店的一个表(multiEntry键除外,后者需要单独的关系表).对于索引基批处理查询,性能可能会大相径庭,例如10倍或100倍,因为YDN-DB将使用SQL查询,而polyfill将使用多个OFFSET查询请求来迭代游标,从而进行迭代.
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.
这篇关于Safari在indexeddb polyfill上显示未定义的索引列.如何在野生动物园中使用索引检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!