LocalStorage vs SQLite?

I am creating a batch application for Chrome. Looking into my database settings, I am curious if I understand the correct way to use them.

With SQLite, I would create a books table with the following rows _id , title , category , date , price , qty_sold .

With localStorage, I would create a _id table with a key / pair, e.g. 1 , x499faj4 . Then I will create a title table with the key / pair x499faj4 , book title . Table category , with x499faj4 , fiction .

I am not sure if that makes sense. localStorage seems easier to implement, but how would I sort these things later to populate the list by category, price, or quantity sold, for example? Does localStorage make sense in this situation, and am I using it correctly? Any further suggestions? thanks

+4
source share
1 answer

localStorage is strictly a storage of keys / values, so any kind of aggregation, sorting, filtering should be in your own application code. SQLite is just a pretty reliable SQL-based storage engine that has sorting, filtering, etc.

SQLite, while a bit more complicated to set up and get started, is likely to be extremely reliable in the long run.

+3
source

Source: https://habr.com/ru/post/1382620/


All Articles