1

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);
Swapnil Mhaske
  • 365
  • 7
  • 21
  • Did you tried the polyfill test cases on the same browser ? Here is the link to the test cases - http://nparashuram.com/IndexedDBShim/test/index.html – GemK Dec 17 '13 at 09:57
  • Yea, as I already said.Same undefined values for index cols there also.I have already contacted parshuram will update this thread if i get any reply. – Swapnil Mhaske Dec 17 '13 at 12:09
  • I also tried using ydn-db but even there I am not able to retrieve the data using the indexes and there I see some numbers instead of undefined present in the index/columns. – Swapnil Mhaske Dec 18 '13 at 10:01
  • I just noticed the exact same issue. However, for me it worked for a while, then the database got corrupt and got all indexes undefined. Also I noticed that occasionally (quite often) if I access the a shimmed db too fast using for example jasmine tests, it starts locking up or returning errornous values. – Morten Dec 18 '13 at 10:11
  • Have you tried Facebooks indexxed db shim?https://github.com/facebook/IndexedDB-polyfill/ – Morten Dec 18 '13 at 10:13

1 Answers1

0

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.

Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • I've got large chunk of data like 13000 rows with 4-5 columns.What do you suggest me?Also I can use YDN-DB but can you show me a demo/prototype where I can insert proper integer and values in indexes on safari.Also traverse using those indexes.Because I was not able to do so using ydn-db but I did saw that one of your demo site had proper values in the indexes/cols in safari. – Swapnil Mhaske Dec 18 '13 at 12:53
  • what do you means, `I was not able to do so` ? – Kyaw Tun Dec 19 '13 at 00:37
  • Thank you @Kywan Tun .Your reply on G+ helped me.[link](http://dev.yathit.com/api-reference/ydn-db/schema.html) . **The type attribute solved my problem when i used ydn-db** .Now I can see the values in safari. Theres no such type attribute available on nparshurams or polyfill . So I think I will be using ydn ahead. – Swapnil Mhaske Dec 19 '13 at 05:43