问题
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