支持和反对 Android SQLite 使用的论据 [英] Arguments for and against the Android SQLite usage

查看:37
本文介绍了支持和反对 Android SQLite 使用的论据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定是否应该在我的 Android 程序中使用 Android SQLite 数据库.

I am unsure if I should use or not Android SQLite database with my Android program.

该程序有几个表,我有查询、更新和显示这些表的操作.但是数据总量不是很大(最多可能有几十行).

The program has several tables, and I have operations for quering, updating and displaying these tables. However the total amount of data is not very large (maybe tens of rows at most).

有些人告诉我我不应该再使用数据库,因为将所有内容存储到平面文件中更容易实现,完成的实现更易于维护,并且数据库引擎可以由存储预加载的集合框架代替平面文件.这些人在决策方面有一定的权重,所以如果我还想使用数据库,我需要论证.

I was told by some people that I should not use databases any more as storing everything into flat files is easier to implement, the finished implementation is easier to maintain and the database engine can be replaced by collection framework that stores pre-loaded flat files. These people have some weight in decision making so I need argumentation if I still want to use the database.

Android SQLite 数据库什么时候该用,什么时候不该用,能不能引起争论?

Would it be possible to get argumentation when Android SQLite database should and when it should not be used?

推荐答案

ContentProvider 抽象了用于持久化数据的实际技术.它允许您很好地分离数据源的实现和此数据的可视化.在这方面,我不认为实施的容易性是支持或反对 SQLite 的好论据.如果您使用 Cursors,您可能无论如何都会使用 ContentProvider.

The concept of a ContentProvider abstracts away from the actual technique used to persist your data. It allows you to nicely separate the implementation of your data source and the visualization of this data. In this respect, I don't think that easiness of implementation is a good argument for or against SQLite. If you use Cursors, you probably will use a ContentProvider anyway.

如果您执行大量(复杂)查询,则查询性能可能是支持 SQLite 的一个论据,因为这是为此而构建的.此外,调试 SQL 数据库似乎比调试平面文件容易得多.

If you perform a lot of (complext) queries, the query performance might be an argument in favor of SQLite since this is what is is built for. Moreover, it seems much easier to debug an SQL database than a flat file.

这篇关于支持和反对 Android SQLite 使用的论据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆