本文介绍了localStorage vs SQLite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建适用于Chrome的打包应用程序。查看我的数据库选项,我很好奇我是否理解使用它们的正确方法。

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.

使用SQLite,我创建表书籍包含以下行 _id title category 日期价格 qty_sold

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

使用localStorage,我会使用键/对创建表 _id ,例如 1 x499faj4 。然后我创建表 title ,其中键/对 x499faj4 书名。表类别 x499faj4 小说

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.

我不确定这是否合理。 localStorage似乎更容易实现,但我怎么会按照类别,价格或数量等方式对这些内容进行排序以填充列表? localStorage在这种情况下是否有意义,我是否正确使用它?还有什么建议?谢谢

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

推荐答案

localStorage 严格来说是一个键/值存储,所以任何一种聚合,排序,过滤都必须在你自己的应用程序代码中。 SQLite 就是这样一个非常强大的基于SQL的存储引擎,配有排序,过滤等功能。

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从长远来看,设置和开始稍微复杂一点可能会非常强大。

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

这篇关于localStorage vs SQLite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 22:02