Android 中使用的 SQLite 版本
Android 使用哪个版本的 SQLite?
我想知道如何处理架构迁移。较新的 SQLite 版本支持 ALTER TABLE SQL 命令,这使我不必复制数据、删除表、重新创建表和重新插入数据。
What version of SQLite is used in Android?
I'm wondering how to handle schema migrations. The newer SQLite versions support an ALTER TABLE
SQL command which save me from having to copy data, drop the table, recreate table and re-insert data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
以下是官方文档的链接,其中包括此答案中的要点: android.database.sqlite 包级 javadoc
用于获取框架 SQLite 版本的 Kotlin 代码(提示:只需在 Activity
onCreate()
中添加一个断点,并在中使用此代码>评估表达式...
):使用模拟器(请注意,实际设备上的 SQLite 版本将至少指定):
* Android API 级别链接显示 android.database.sqlite< 的位置/a> 包已更改。如果没有链接(例如 API 级别 17),则表示该包没有更改。
** 损坏的 SDK 链接,请参阅此处
注意:如果您希望您的应用使用相同版本要跨所有 Android 版本使用 SQLite,请考虑使用 Requery 的第三方 SQLite 支持库 或 SQLCipher (如果您还想要加密)。
Here is a link to the official docs which include the main points in this answer: android.database.sqlite package-level javadoc
Kotlin code to get framework SQLite version (tip: just stick a breakpoint in your Activity
onCreate()
and use this code inEvaluate Expression...
):Using the emulators (note, SQLite version on actual devices will be at least that specified):
* Android API level links show where the android.database.sqlite package has changed. Where there is no link (e.g. API level 17), indicates no changes to that package.
** Broken SDK link, see here
Note: if you want your app to use the same version of SQLite across all Android versions, consider using Requery's 3rd party SQLite support library or SQLCipher (if you also want encryption).
尽管文档给出了 3.4.0 作为参考号,但如果执行以下 sql,您会注意到安装的 SQlite 数量要多得多:
这只是一段用于检索 sqlite 版本的快速、肮脏的代码。例如,在搭载 Android 2.1 的 HTC Hero 上,我得到:3.5.9。
在我的 Android 2.2 Nexus One 上,我什至得到了3.6.22。
Although the documentation gives 3.4.0 as reference number, if you execute the following sql, you'll notice that there is a much higher number of SQlite installed:
This is just a piece of quick, dirty code to retrieve the sqlite version. For instance on a HTC Hero with Android 2.1, I get: 3.5.9.
On my Nexus One with Android 2.2, I even get 3.6.22.
ADP1 1.6 和 ADP1 1.6 上相同2.1 模拟器。
Same on ADP1 1.6 & 2.1 emulator.
Andorid API 和支持的 SQLite 版本的简短概述。
概述来自马克回答中的链接。
A short overview of the Andorid APIs and the supported SQLite versions.
The overview is from the link in Mark's answer.
在 Room 中您可以查询
SELECT sqlite_version()
RG
In Room you can query
SELECT sqlite_version()
RG