Make the distinction between the old and the new implementation for IndexedDB #15

Merged
merged 1 commit into from Oct 9, 2012

Projects

None yet

2 participants

@julienw

add Partial information about IndexedDB for browsers supporting the old way of upgrading a database. Also added that Chrome 24 doesn't need a prefix.

I'm not sure for Mobile Firefox (and also maybe we'd need other versions in caniuse.com to be acurate).

@julienw julienw add Partial information about IndexedDB for browsers supporting the o…
…ld way of upgrading a database. Also added that Chrome 24 doesn't need a prefix.
6b45178
@Fyrd Fyrd merged commit 5337850 into Fyrd:master Oct 9, 2012
@Fyrd
Owner

Thanks! Could you explain or link me to an explanation on the difference between the old and new way you refer to?

@julienw

The difference lies in the open method (https://developer.mozilla.org/en-US/docs/IndexedDB/IDBFactory#open) and setVersion (https://developer.mozilla.org/en-US/docs/IndexedDB/IDBDatabase#setVersion%28%29)

This shim should make it easier to use the new method even in older implementations : https://gist.github.com/3361666#file_upgradeneeded.js (haven't tried it yet, will do soon)

@julienw

The difference is when you need to upgrade the structure of the database (ie: increase the version).

In the new implementation, you simply put an higher number in the second parameter of the open method, and implement the upgrade in the onupgradeneeded handler.

In the old implementation, you're supposed to do the following in the success handler of the open method:

  • compare the version you want and the current version of the database
  • if it's higher, call setVersion
  • in the success handler, upgrade the database, then close it, and open it again. Or maybe it works working again in the transaction's complete handler, that's not so clear to me yet.
@AMorgaut AMorgaut referenced this pull request in AMorgaut/caniuse Apr 6, 2013
@AMorgaut AMorgaut Add Web Cryptography feature aeba925
@miguelao miguelao pushed a commit to miguelao/caniuse that referenced this pull request Aug 24, 2016
@NOtherDev NOtherDev Rename “push notifications“ to “push messages” #15 f3b8d7f
@miguelao miguelao pushed a commit to miguelao/caniuse that referenced this pull request Aug 24, 2016
@NOtherDev NOtherDev Rename “push notifications“ to “push messages” #15
 - missing title
557fcc5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment