The problem:
I need a device agnostic (e.g. HTML5) solution for storing and querying 250,000+ rows of data offline on a phone or tablet type device (e.g
"I've seen things like lawnchair but I'm pretty sure it only lets you use local storage by default and falls back to the to the others. I think I'd rather it used Web SQL (by default) then the slower options."
This is configurable, each of the 'adapters' for storage engines is self contained, you can pass an adapter to the Lawnchair constructor, or, alternatively, change the order in which it falls back to other storage options by concatenating the javascript files differently when creating the library. e.g. for indexed-db then falling back to sqlite then gears sqlite:
git clone https://github.com/brianleroux/lawnchair.git
cd lawnchair
cat src/Lawnchair.js src/adapters/indexed-db.js src/adapters/webkit-sqlite.js src/adapters/gears-sqlite.js > my_lawnchair.js
Of course, as the other answers suggest, you can wrap your html5 into an native app using phonegap etc. then you'll have plenty of options, but if you want to stick to web standards then this may be a good way to go until we've got wide adoption of IndexedDB.
I would recommend checking out the JayData library, that actually has the exact purpose of creating a storage agnostic data access layer for mobile devices. JayData provides an abstraction layer with JavaScript Language Query (JSLQ) and JavaScript CRUD support and let's you work on the exact same way with different offline and online data store types. JayData supports dealing with complex entities and also entity relationships either locally or remotely.
At the time of writing JayData supports the following stores or protocols: webSQL(sqLite)/IndexedDB/OData/YQL/FBQL.
Your particular problem with different systems providing different storage engines can be easily addressed with the provider fallback feature of JayData: it will use whatever storage layer it can find while still provides the same API toward the consumer code.
With regarding WebSQL being deprecated by 2012: at the time of writing it is WebSQL that still has a 95% device coverage including Samsung SmartTV and amazon Kindle. Check out kindle executing WebSQL unit tests with JayData.
I've made some more research while looking for a solution for my own project. It looks like this library is rather promising: http://nparashuram.com/IndexedDBShim/
It allows to use IndexedDB API having WebSQL behind the scenes.
It's tests pass on recent iPad, iPhone 5, Android 4.2.2.
Hope this helps someone.
I would tell you to use Corona for it . It's a private Platform used for crossed-mobile applications which has support to SQLite .
Pros
Cons
I paste here what they say about it:
Corona includes support for SQLite databases on all platforms. This is based on the built-in sqlite support on the iPhone, and a compiled version of SQLite on Android. Note that this increases the size of the Android binary by 300K.
SQLite is available in all versions of Android, iPhone, and iPad, as well as in the Corona Simulator...
Why not write a simple storage engine in javascript (which covers the "standards-based" part)? Apparently you don't need anything very fancy, so it should not take too much effort to have it working.
I would do the following:
This solution is only feasible if the database is simple enough. But I think it might work -- javascript support is good on mobile devices.
For inspiration here is a Btree+ implementation in javascript.
To read the local files you will need the file API, which can be used to access local files. It is supported in most modern browsers, even Safari 6. I have not been able to determine if current iPhone browsers support this API though.
It worths to check out my open source library https://bitbucket.org/ytkyaw/ydn-db/wiki/Home
Javascript database module for Indexeddb, WebDatabase (WebSQL) and WebStorage (localStorage) storage mechanisms supporting version migration, advanced query and transaction.
Being NoSQL library, join is manual, but not impossible. There is already key joining algorithms build-in the library.