PhoneGap / iOS SQLite Database - More Than 5 MB Possible

I got a little confused about the limitations of using SQLite in Phonegap-Native app for iOS.

You can read a lot of messages about the 5 MB storage limit and that your iPad may ask you to increase the storage capacity.

Now I managed to insert almost 7000 rows into my SQLite database using the regular Phonegap-Storage-API. The corresponding db file is 26 MB in size. The following select-statement "select * from" worked and showed the contents of db. I did this in the simulator and on the device. I did not have a question to increase the storage capacity.

How can it be? Am I misunderstanding something? Is there really a 5mb limit for SQLite dbs in Phonegap? I am using Phonegap 1.2 and iOS 5.

+7
source share
3 answers

You can use your own SQLite DB (the same as WebSQL) with the phone plugin, and you will not have any restrictions. In iOS5.1, WebSQL is considered temporary data that can be deleted at any time ... This plugin saves the database in the Document folder, which means that the database is not deleted and iCloud is saved.

Here is the plugin for the native SQLite phonegap: https://github.com/davibe/Phonegap-SQLitePlugin As for this plugin, there are some differences between the WebSQL APIs, here is the adapter: https://gist.github.com/2009518

You must also transfer the old WebSQL database file (stored in the Library / WebKit or Caches directory) to the Document folder. Here is the code for this: https://gist.github.com/2009491

And if the data is important, you must save it on the server. I wrote a small library for synchronizing SQlite DB with the server: https://github.com/orbitaloop/WebSqlSync

+10
source

I found out myself:

Successfully open the first transaction and insert 7000 records at a time in one and only transaction.

If I divide the inserts into separate transactions, say 500 records per transaction, the 5 MB limit affects. Phonegap doesn't say anything, it just doesn't insert records.

+3
source

The problem with HTML5 storage on devices will not allow you to increase the size. Check out this solution:

Fixed 5 MB iOS database size limit (using plugin)

Hope this helps you.

Greetings

+1
source

All Articles