I have a product database which I want to distribute to an iphone user application. Its data is stored in an SqlLite database.
What i want to ask is: If i update one products’ price in the database, what is the best approach to update the users copy of the database in the iphone application ? I don’t want to send the whole database time to iphone users.
If i send only updated products every db will be different on each iphone after some time.
I am pretty confused.
Any idea will be appreciated.
Thanks for your help
You could use a global revision Id for your database. Each item in your database would additionally include a field which keeps track of the revision they were last updated at. This is much like the way subversion works.
Whenever you update one or more fields in your central database you will increment the global revision number as well as the revision number for each of the updated entries.
Your iPhone database copy would then have to keep track of its own revision. Whenever it connects to the main database it can then ask for changes made since its own revision.
Eg. if the main database is at revision 1234 and the iPhone is at revision 1222, it would. Then receive the updates corresponding to 1223, 1224, etc.