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

查看:732
本文介绍了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天全站免登陆