是否有人可以解释这个code片段 [英] Can someone please explain this code snippet

查看:152
本文介绍了是否有人可以解释这个code片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试打开网页浏览器(从家中的Kindle Fire HD),它只是简单的无法启动。
我检查了设备日志,并能找到例外如下:

android.database.sqlite.SQLiteException:不能从版本升级29只读数据库27

我GOOGLE了异常,并能找到下列code段是抛出此异常。可能有人请解释清楚这一点。而我需要为这个做

  {尝试
             mIsInitializing = TRUE;
             字符串路径= mContext.getDatabasePath(MNAME).getPath();
             DB = SQLiteDatabase.openDatabase(路径,mFactory,SQLiteDatabase.OPEN_READONLY,
                     mErrorHandler);
             如果(db.getVersion()!= mNewVersion){
                 抛出新SQLiteException(无法从版本升级只读数据库+
                         db.getVersion()+至+ mNewVersion +:+路径);
             }


解决方案

您可以给多一点的背景下,尤其是Kindle的产品运行Android的一个分支。

至于来源我才能够找到tar包:

http://www.amazon.com/gp/help/customer/display.html?nodeId=200203720&tag=viglink121875-20

你没有

如何让上面显示的源$ C ​​$ C(请链接)?

在code说,这是不ppared支持所有不同的数据库版本之间的升级$ P $。

什么它会在你的情况做的是从版本29升级到27,这将是一个降级。

when I try to open the web browser (from home in Kindle fire HD) and it just plain fails to launch. I checked the device logs and could find below exception:

android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 29 to 27

I googled the exception and could find the following code snippet is throwing this exception. Could some one please explain clearly about this. And what I need to do for this

try {
             mIsInitializing = true;
             String path = mContext.getDatabasePath(mName).getPath();
             db = SQLiteDatabase.openDatabase(path, mFactory, SQLiteDatabase.OPEN_READONLY,
                     mErrorHandler);
             if (db.getVersion() != mNewVersion) {
                 throw new SQLiteException("Can't upgrade read-only database from version " +
                         db.getVersion() + " to " + mNewVersion + ": " + path);
             }

解决方案

You could give a bit more context, especially since Kindle products are running a fork of Android.

Regarding sources I was only able to find tarballs:

http://www.amazon.com/gp/help/customer/display.html?nodeId=200203720&tag=viglink121875-20

How did you get to the source code shown above (link please)?

The code says that it is not prepared to support upgrades between different database versions at all.

What it would have to do in your scenario is upgrade from version 29 to 27, which would be a downgrade.

这篇关于是否有人可以解释这个code片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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