问题描述
我有一个Web服务和sqlite数据库。在这里,web服务将用于存储数据库内的数据。现在我想将同步功能包括在内 - 每当应用程序启动时,数据库将开始通过Web服务加载其表的数据。
现在,在我更新我的网络服务后,数据库将相应更新。我的问题是,这个更新我必须遵循的最佳做法是什么。我应该清除整个数据库,并开始添加所有的行(我知道这将需要很多时间),但如果不是这样,那么我的数据库将如何添加从Web服务的特定数据?
谢谢。
我建议你:
$ b $
因此,您将始终可以找到所有您的新鲜数据到数据库。
I have a Web Service and sqlite database. In this, web service will be used to store data inside database. Now I want to include sync functionality as - Whenever application starts at that time the database will start to load its table's data through web service.
Now after some time when I update my my web service the database will be updated accordingly. My question is that what are the best practices that I must follow for this update. Should I clear whole DB and start adding all rows again(I know this will take a lot time) but If not this then how do my database will add only particular data from the web service?
Thank you.
What I suggest you is:
- store all your webservice content into db first when the app starts.
- display your content on the screen from db only.
- again when you need to refresh or recall your data just update the database.
Thus, you will always find all your fresh data into database.
这篇关于从WebService(Json / XML)为iOS的同步数据库(sqlite)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!