PhoneGap / iOS上的SQLite数据库 - 超过5mb可能 [英] SQLite database on PhoneGap / iOS - More than 5mb possible

查看:196
本文介绍了PhoneGap / iOS上的SQLite数据库 - 超过5mb可能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对在iOS上的Phonegap-Native-App中使用SQLite的限制感到困惑。

I'm a little confused about the limitations of using SQLite in a Phonegap-Native-App on iOS.

您可以阅读许多有关5mb限制的帖子存储和事实,你的Ipad可以要求你增加存储。

You can read many posts about the limit of 5mb storage and the fact, that your Ipad can ask you to increase the storage.

现在我已经设法插入近7000行到我的SQLite数据库,使用通常的Phonegap -Storage-API。相应的db文件的大小为26 MB。以下选择语句select * from起作用,并显示数据库的内容。
我在模拟器和设备上做到了。我没有得到增加存储空间的问题。

Now I've managed to insert nearly 7000 rows into my SQLite database, using the usual Phonegap-Storage-API. The corresponding db-file has a size of 26 MB. A following select-statement "select * from " worked and was showing the db's content. I've done that in the simulator and on the device. I didn't get the question to increase the storage.

这怎么可能?我误会了什么?
在Phonegap中SQLite dbs真的有5mb的限制吗?
我使用Phonegap 1.2和iOS 5。

How can that be? Do I misunderstand something? Is there really a 5mb limit for SQLite dbs in Phonegap? I'm using Phonegap 1.2 and iOS 5.

推荐答案

您可以使用本地SQLite数据库)与一个phonegap插件,你不会有任何限制。在iOS5.1中,WebSQL被认为是临时数据,可以随时删除...该插件将数据库保存在Document文件夹中,这意味着数据库不会被删除并由iCloud保存。

You can use a native SQLite DB (same as WebSQL) with a phonegap plugin, and you will not have any limitation. In iOS5.1, WebSQL is considered temporary data that can be deleted at any time...That plugin save the database in the Document folder, that mean that the DB is not deleted and is saved by iCloud.

这是Native SQLite phonegap插件: https://github.com/davibe/Phonegap-SQLitePlugin
关于这个插件,WebSQL API之间有一些区别,这里有一个适配器:
https: //gist.github.com/2009518

Here is the Native SQLite phonegap plugin : https://github.com/davibe/Phonegap-SQLitePlugin Regarding this plugin, there are some differences between the WebSQL API, here is an adaptor: https://gist.github.com/2009518

您还应将旧的WebSQL数据库文件(存储在Library / WebKit或Caches目录中)迁移到文档夹。下面是一个代码:
https://gist.github.com/2009491

You should also migrate the old WebSQL db file (stored in Library/WebKit or Caches directory) to the Document folder. Here is a code to do that : https://gist.github.com/2009491

如果数据很重要,你应该将它保存到服务器。我写了一个小库来将SQlite DB同步到服务器:
https://github.com/orbitaloop/WebSqlSync

And if the data are important, you should save it to a server. I wrote a small lib to synchronize the SQlite DB to a server : https://github.com/orbitaloop/WebSqlSync

这篇关于PhoneGap / iOS上的SQLite数据库 - 超过5mb可能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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