准备要远程加载的 SQLite 数据库以进行移动开发
我的移动 Titan 应用程序正在从远程 URL 加载我生成的 xml 文件形式的数据。这个想法是应用程序正在下载该 xml 并将其处理到 SQLlite 数据库中。但我在想,我也可以用包含所有数据的现成 sqlite 文件替换服务器端生成的 xml。这样,我不需要在客户端做任何处理,这节省了用户的一些时间。
这是个好主意吗?如果是,我将如何“伪造”生成 sqlite 文件?我没有需要传递的标头,所以这不是问题,但当我用 coda 打开 .sqlite 文件时,我注意到有一些奇怪的字符,这意味着编码必须不同。
谢谢!
My mobile titanium app is loading data from a remote url, in the form of a xml file, that I have generated. The idea is that the app is downloading that xml and processes it into a SQLlite db. But I was thinking, I could also replace the server side generated xml with a ready sqlite file with all the data in it. That way, I don't need to do any processing client side, which saves some of the user's time.
Is this a good idea? If yes, how would I "fake" generate a sqlite file? There are no headers that I need to pass on, so that's not the issue, but what I noticed when I opened an .sqlite file with coda, that there are weird characters meaning the encoding must be different.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,在任何浏览器中都没有任何机制允许您传输 sqlite 数据库的二进制图像(即使假设字节排序和字符编码不是问题)。
当然,以比原子 XML 更接近一组 CREATE 和 INSERT 语句的格式维护/传输数据可能会提高性能。
There is no mechanism in any browsers I am aware of which would allow you to transfer a binary image of a sqlite database (even assuming byte ordering and character coding were not an issue).
Certainly, it may improve performance to maintain / transfer the data in a format closer to a set of CREATE and INSERT statements than atomic XML.
您可以在许多程序中创建 SQLite 数据库 - 我使用 MesaSQLLite。它只是一个二进制文件。以下是在 iOS 上下载和安装的示例。我还没有在安卓上测试过。
注意:我不确定应用商店是否会批准这一点,因为他们不太热衷于远程获取数据。
You can create a SQLite database in many programs - I use MesaSQLLite. It is just a binary file. Here is an example of downloading and installing on iOS. I have not tested it on Android.
Note: I'm not sure the App Store would approve this as they are not too keen on fetching data remotely.