Windows Phone 8.1破坏了SQLite数据库

时间:2014-11-16 03:13:29

标签: c# sqlite windows-phone-8 windows-phone-8.1 corruption

我有一个Windows Phone 8应用程序,Windows Phone 8.1上的一些用户报告了问题。似乎SQLite文件以某种方式被破坏了。

该应用包括以下项目参考:

  • 适用于Windows Phone的SQLite(SQLite.WP80,版本= 3.8.5)
  • SQLite的

我正在使用Peter Huene的sqlite-net-wp8 3.8.5(来自NuGet)。

该应用程序允许下载SQLite文件以使大量数据可脱机使用。应用程序只能以只读模式打开这些应用程序,如下面的代码片段所示。两个可用的SQLite数据库文件都非常大--1.8 GB和2.6 GB。用户可以下载这些文件中的一个或两个。

using (SQLiteConnection conn = new SQLiteConnection(_filePath, SQLiteOpenFlags.ReadOnly))
{
    SQLiteCommand cmd = new SQLiteCommand(conn);
    cmd.CommandText = "SELECT EXISTS(SELECT 1 FROM tiles WHERE z=" + zoomLevel.ToString() + " AND x=" + x.ToString() + " AND y=" + y.ToString() + " LIMIT 1);";
    canProvideMapTile = cmd.ExecuteScalar<bool>();
}

我在日志中看到的错误是:

SQLite.SQLiteException: file is encrypted or is not a database
at SQLite.SQLite3.Prepare2(Database db, String query)
at SQLite.SQLiteCommand.Prepare()
at SQLite.SQLiteCommand.ExecuteScalar[T]()

从日志中我可以看到2个设备遇到过这个问题。两个设备ID都以“RM-941”开头,所以看起来它们都是Lumia 625。也许问题仅限于这种特定的设备模型,或者这只是巧合?下载大文件是可选的,仅供少数用户使用。

其中一位用户将应用程序安装到手机SD卡上,因此能够为我检索数据库文件。实际上,当我尝试使用SQLite Expert打开数据库文件时,我看到了“文件已加密或不是数据库”消息。

该文件的大小与未损坏的原始文件完全相同,但是当我运行“comp”来比较这两个文件时,确实显得不同。这是comp输出:

Compare error at OFFSET 0
file1 = DB
file2 = 53
Compare error at OFFSET 1
file1 = BD
file2 = 51
Compare error at OFFSET 2
file1 = 65
file2 = 4C
Compare error at OFFSET 3
file1 = 51
file2 = 69
Compare error at OFFSET 4
file1 = 45
file2 = 74
Compare error at OFFSET 5
file1 = BE
file2 = 65
Compare error at OFFSET 6
file1 = A7
file2 = 20
Compare error at OFFSET 7
file1 = 5E
file2 = 66
Compare error at OFFSET 8
file1 = 8A
file2 = 6F
Compare error at OFFSET 9
file1 = 4F
file2 = 72
10 mismatches - ending compare

用户提供的详细信息:

电话h / w是:

  • Lumia 625
  • 制造商:RM-941_ [REMOVED]
  • 固件版本:3058.50000.1424.0003
  • 硬件版本:3.0.0.0
  • Radio s / w ver:3.2.28072.7
  • Chip SOC ver:8930
  • 屏幕:480x800

电话o / s是:

  • 列表项
  • Windows 8.1 Cyan
  • 版本:8.10.12393.890

用户已尝试卸载并重新安装该应用,但问题仍然存在。

有什么想法可能会发生什么?

1 个答案:

答案 0 :(得分:0)

手机出现问题似乎是通过恢复出厂设置解决的。从解决问题的用户引用:

&#34;对625进行恢复出厂设置可以解决问题,直接指向有缺陷的8.0到8.1升级过程。&#34;

相关问题