Let me have the ability to perform the following inside a HTML5 (iPad) web application:
- upload data for an online database (which may be most likely <50Mb in dimensions basically ended up being to build the internet database in something similar to SQLite)
- extract whether subset or perhaps a full copy of information for an offline webdatabase
- (travel from 3rd generation network coverage range)
- perform a lot of analytic-type information around the downloaded data
- save parameters for my information towards the offline webdatabase
- repeat, saving different parameter sets for many different offline analytic-type calculation periods over a long period
- (mind back to areas with 3rd generation network coverage)
- sync the saved parameters from the offline webdatabase towards the central, online database
I am confident with everything up up until the 4g iphone...
I am looking for info on whether you can sync an offline webdatabase having a central database, but aren't able to find anything since the subject. Can you really do that? If that's the case, would you please supply link/s to info on it, OR describe the way it works in enough detail to implement it for my specific application?
Thanks ahead of time
I havent't labored particularly with HTML5 local databases, however i have labored with mobile products that need offline updates and resyncing to some central data store.
If the dataset is produced around the server or around the offline client, I make certain its primary secret is a UUID. I additionally make certain to timestamp the record every time its up-to-date.
I additionally make not of once the before the offline client was synced.
So, when resyncing towards the central database, When i first query the offline client for records which have transformed because the last sync. Then i query the central database to find out if any one of individuals records have transformed because the last sync.
When they haven't transformed around the centeral database, I update all of them with the information in the offline client. When the records around the server have transformed since last sync, I update these to the customer.
When the UUID doesn't exist around the central server but does around the offline client, I place it, and the other way around.
To get rid of records, I produce a "purge" column, so when the sysnc totally run, I remove the record from each database (or measure the level as inactive, based on application needs).
If both records have transformed since last update, I must either depend on user input to reconcile or perhaps a rule that identifies which record "wins".
It's my job to don't trust built-in database import funtions, unless of course I am posting right into a completely empty database.
- Keep a listing of changes around the local database.
- When attached to remote database, look for any changes since last sync on remote.
- If changes on remote side has conflicts with local changes, inform the consumer on how to proceed.
- For those other changes, proceed with sync:
- download all online changes which didn't change in your area.
- upload all local changes which didn't change remotely.
This process can really focus on any mixture of databases, provided there's an information convertor on one for reds.
It appears in my experience, from the couple of sites I visited, that (as lengthy when you are using SQLite for the Server db) it ought to be possible.
HTML5 webdatabases also employ SQLite (while not all browsers support it and W3C appears to possess dropped support for this)
Should you export the information while using .dump command after which import the information in to the webdatabase while using $sqlite mydb.db < mydump.sql syntax you need to have the ability to do that with a few fidgeting having a php or java after sales?
Then when you wish to sync the "offline" data for your server just target your product dump in the webdatabase to some dump.sql file and import towards the server database
This website describes conveying to and posting from SQLite dumps