E/SQLiteLog: (10) 文件读取失败,得到:0,amt:100,最后一个错误:2 [英] E/SQLiteLog﹕ (10) Failed to do file read, got: 0, amt: 100, last Errno: 2

查看:24
本文介绍了E/SQLiteLog: (10) 文件读取失败,得到:0,amt:100,最后一个错误:2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Android 的 SQLite 数据库中实现外键.

I'm implementing Foreign Keys in my SQLite DB in Android.

我的数据库在没有 FK 的情况下运行良好,但现在我遇到了几个问题.

I had my DB working well without FK, but now, I have several problems.

一个是当我尝试获取对 db 的引用时,出现此错误.

One is when I try to get reference to db, I have this error.

E/SQLiteLog﹕ (10) Failed to do file read, got: 0, amt: 100, last Errno: 2

我的功能:

public synchronized SQLiteDatabase openDatabase() {
    if (mOpenCounter.incrementAndGet() == 1) {
        // Opening new database
        mDatabase = mDatabaseHelper.getWritableDatabase();
        // Get Foreign Key Support
        mDatabase.execSQL("PRAGMA foreign_keys=ON");

    }
    return mDatabase;
}

错误发生在这一行:

mDatabase = mDatabaseHelper.getWritableDatabase();

这行好像是第一次被调用.其他时间,没有pb.我不确定它是否会给我直接错误,但我在 SQLite 中有几个问题,所以它可能会导致不良行为.

It seems to be the first time that this line is called. Other time, there is no pb. I'm not sure it gives me direct errors, but I have several problems in SQLite, so it might contribute to bad behaviour.

发送

推荐答案

试试这个:

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"

这篇关于E/SQLiteLog: (10) 文件读取失败,得到:0,amt:100,最后一个错误:2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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