This is basically the same question as this one, except that I'm not using PhoneGap (so I don't think any of the solutions offered there are applicable).
I have a pure HTML/JS webapp that works offline (using WebSQL for storage, and AppCache for disconnected use).
The app has an 'export' option which serializes the data as JSON and uploads it to an AWS S3 bucket for backup; and a corresponding 'import' option for restoring. However as this is a full dump/restore of the entire db, the process is not all that fast so typically I backup on a weekly basis.
As anticipated, the OTA upgrade from iOS 5 to 5.1 deleted my local webSQL database, but I was able to successfully restore the data from S3 (luckily, I'd just done a backup prior to the upgrade).
Unfortunately, after a couple of weeks running iOS 5.1, it has again decided that it needed the space, and deleted my webSQL db. Again, I'm lucky that this has occurred just after my regular weekly backup; but I'm concerned that if this becomes a regular occurrence (iOS deleting this 'temporary' database to reclaim space) it won't be long before I'm caught out by not having backed up for a few days.
I am planning to eventually move off the now defunct WebSQL, and use IndexedDB; but of course iOS doesn't yet support IndexedDB. I'm also planning to modify the export/import process in my app such that instead of doing a full dump/restore, it just syncs any changed records with S3 (so that backing up to S3 is less of hassle, and therefore likely to be done more frequently than weekly).
In the meantime, are there any hacks/workarounds/tricks to ensuring that a WebSQL db is not cleared by iOS 5.1; or is there any way that I can predict when a cleanup is likely to happen, so that I can attempt to preempt it by running an export to backup my data?