Android 在哪里存储 SQLite 的数据库版本? [英] Where does Android store SQLite's database version?

查看:38
本文介绍了Android 在哪里存储 SQLite 的数据库版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到 Android 在 SQLite 数据库文件中存储数据库版本的位置.数据库版本究竟存储在哪里?

I am unable to find where Android stores the database version within the SQLite database file. Where exactly is the database version stored?

推荐答案

您可以使用android.database.sqlite.SQLiteDatabase.getVersion()读取版本.

在内部,此方法执行 SQL 语句 "PRAGMA user_version".我从 Android 源中得到了它代码.

Internally, this method executes the SQL statement "PRAGMA user_version". I got that from the Android source code.

在数据库文件中,版本存储在数据库头 数据库文件的用户 cookie"字段中.

In the database file, the version is stored at byte offset 60 in the database header of the database file, in the field 'user cookie'.

这篇关于Android 在哪里存储 SQLite 的数据库版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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