开发者

Android updating database differentially

HI All,

I am developing an application which would need to regularlay update the database from the server. I am planning to get the database from server in json format.

But I want to update the data for those records which have been updated on the server.开发者_运维问答 I do not want to download the complete database but only the differential database so that data transfer is minimum each time.

What is the best way to achieve this? Any sample code available?

Rgds, Sapan


Simply put a *modified_date* column in the corresponding tables in the database and ensure it is updated by server(or some other mechanism such as using database provided facilities) whenever a row is updated/added. At any time you can request the records which have *modified_date* greater than the time when last query was executed. On your application you have to maintain the time when the data was last fetched.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜