title: Wrapper functions for IndexedDB
body: <p>I need to build an offline HTML5 web app for a iPad/tablet device where the user can download a dataset (table of data) from the server and store it on the device. The user could then disconnect from the server and view/edit the data locally on the device. This is for people who work out in remote areas where there's no cellular coverage and need to collect/update data. When they come back into the office they can sync/upload the data back to the server. The reason it needs to be HTML5 is so it's platform agnostic, ie can run it on iOS, Android etc as long as it has a modern web browser that supports HTML5.</p>
  
  <p>Now I've already built the system using HTML5 local storage (for the data) and the HTML5 offline application cache (for the pages/css/js/images) and it works reasonably well with small datasets (I can view, edit and save while offline and load/sync while online). Now I need to scale up to 10,000 rows of data. It works but it's pretty slow and hangs the browser for 10secs while loading on an Intel quad core 8GB machine.</p>
  
  <p>So I've been researching a few better alternatives than local storage:</p>
  
  <p>1) WebSQL: Would be able to query the data using SQL language and do joins etc. Problem is it's now deprecated an won't be supported any longer so I don't want to invest time building something for it.</p>
  
  <p>2) IndexedDB: Uses an object store (which technically I'm already storing objects using local storage API and storing using JSON). Potentially is faster as it uses indexes with the SQL lite backend. There's lots of boilerplate code to do simple tasks like creating the database, adding to it, reading from it, iterating over it. I just want to do a simple query like <code>select(xyc, abc).where(abc = 123).limit(20)</code> but instead have to write a lot of JavaScript code to do it. How does one write their own code to do joins between tables, any examples anywhere?</p>
  
  <p>I've found one <a href="http://nparashuram.com/IndexedDB/jquery/">jQuery plugin</a> that might make life simpler. Are there any other ones around or other libraries that ease the pain of using IndexedDB?</p>
  
  <p>Many thanks!</p>