storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.15k stars 715 forks source link

What's the difference to using localStorage? #582

Open mxmzb opened 7 years ago

mxmzb commented 7 years ago

I am wondering what are the differences between using a sqllite database and using localStorage? Both seem to be backed up by iCloud and both can store key / value pairs, so what's the major advantage from using the one above the other?

brodycj commented 7 years ago

Here are a few benefits I can think of:

kashban commented 7 years ago

Good points by @brodybits , but there is more:

This seems to be the case with an app a customer recently published, though I don't have exact proof.

There are also drawbacks of SQlite storages and such:

brodycj commented 7 years ago

Nice link, I will add it to README.md when I get a chance.

  • LocalStorage access is synchronous while SQLite and similar are asynchronous. This results in much more application logic required to use those solutions.

That is definitely true. I recently published brodybits / sql-promise-helper to make some SQL operations easier for a customer and will add more if there is interest from the community.