将数据库更新分发到iPhone应用程序,而无需下载整个数据库 [英] Distributing database updates to an iPhone application without downloading the whole database

查看:40
本文介绍了将数据库更新分发到iPhone应用程序,而无需下载整个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要分发给iphone用户应用程序的产品数据库.其数据存储在SqlLite数据库中.

I have a product database which I want to distribute to an iphone user application. Its data is stored in an SqlLite database.

我想问的是:如果我更新数据库中一种产品的价格,那么在iphone应用程序中更新用户数据库副本的最佳方法是什么?我不想将整个数据库时间发送给iPhone用户.

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.

如果我只发送更新的产品,则一段时间后,每个iphone上的每个数据库都会有所不同.我很困惑.

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.

感谢您的帮助

推荐答案

您可以为数据库使用全局修订ID.数据库中的每个项目还将另外包含一个字段,用于跟踪它们上次更新的修订版本.这很像颠覆的工作方式.

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.

无论何时更新中央数据库中的一个或多个字段,您都将增加全局修订号以及每个更新条目的修订号.然后,您的iPhone数据库副本将不得不跟踪其自身的修订.每当它连接到主数据库时,它都可以请求自其修订以来的更改.

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.

例如.如果主数据库的版本为1234,而iPhone的版本为1222,则它将.然后接收对应于1223、1224等的更新.

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.

这篇关于将数据库更新分发到iPhone应用程序,而无需下载整个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆