
How To Use IndexedDB - Simple Example - ronreiter
http://greenido.wordpress.com/2012/10/05/how-to-use-indexeddb-simplest-example/ 
======
dreamdu5t
Anybody thinking of using IndexedDB should be familiar with the concept of
unhosted apps and remote storage, because IndexedDB is one of the technologies
that may comprise remoteStorage-compatible websites and webapps.

<http://www.w3.org/community/unhosted/wiki/RemoteStorage>

<http://unhosted.org/>

We should use this client-side storage solutions to move in the direction of
clients owning and controlling their data - along with better support for
offline use.

~~~
greenido1
Very true... I agree, we should have (another) example that show the power of
'offline' with indexedDB.

------
TazeTSchnitzel
I wish we had just stuck with WebSQL.

~~~
axemclion
WebSql was just about a single open source project - SQLite. IndexedDB seems
to move away from the requirement that a standard is based on a product. Also,
the SQL used in WebSql was not standardized.

~~~
TazeTSchnitzel
Yes. But SQLite 3 is Public Domain, and I expect you could reimplement it in
the browser if you really wanted to.

~~~
MatthewPhillips
But the parent's point stands; IndexedDB is just a set of APIs. A browser
vendor can implement it on the backend any way they want. Chrome uses LevelDB
and Firefox uses SQLite. When WebSQL they were stuck with improving SQLite.

~~~
ef4
Unfortunately they chose a set of APIs that is strictly weaker than what we
have access to via WebSql.

When I port from WebSql to IndexDb, I will need to implement in Javascript a
bunch of things that sqlite3 is already doing for me in C.

I actually started out with a very NoSQL-like architecture on top of WebSql
that's closer to the IndexDb model. But when I started taking more advantage
of sqlite3 to do the heavy lifting (joins, nested subqueries, etc) I got an
order of magnitude better performance. Switching to IndexDb means going back
to the slow way.

------
MatthewPhillips
This polyfill for onupgradeneeded lets you ignore the Chrome deficiency. Come
on Chrome team, it's been almost a year since this change happened.

[https://raw.github.com/matthewp/multientry-
shim/master/upgra...](https://raw.github.com/matthewp/multientry-
shim/master/upgradeneeded.js)

~~~
streptomycin
Chrome 23 supports onupgradeneeded.

------
axemclion
Added this IndexedDB polyfill to the example and was able to get it running on
all browsers

[http://axemclion.github.com/IndexedDBShim/dist/IndexedDBShim...](http://axemclion.github.com/IndexedDBShim/dist/IndexedDBShim.min.js)

~~~
kyawtuns
Instead of shimming, directly wrapping IndexedDB API and fail back to WebSQL
have better performance and more robust <https://bitbucket.org/ytkyaw/ydn-db>

