localStorage vs SQLite?

冷暖自知 提交于 2019-12-23 12:27:46

问题


I'm building a Packaged App for Chrome. Looking into my database options, I'm curious if I understand the proper way of using these.

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

With localStorage, I'd create table _id with key/pair such as 1, x499faj4. Then I'd create table title with key/pair x499faj4, book title. Table category, with x499faj4, fiction.

I'm not sure if that makes sense. localStorage seems easier to implement but how would I then go about sorting those things to populate a list by category, price or quantity sold for example? Does localStorage make sense in this situation and am I using it properly? Any further suggestions? thanks


回答1:


localStorage is strictly a key/value store, so any kind of aggregation, sorting, filtering will all have to be in your own application code. SQLite is just that, a pretty robust SQL based storage engine, complete with sorting, filtering, etc.

SQLite while a little more complex to setup and get started will probably be extremely more robust in the long run.



来源:https://stackoverflow.com/questions/8236342/localstorage-vs-sqlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!