gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 06:29:46 25 4
gpt4 key购买 nike

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

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

一个是当我尝试获取对数据库的引用时,我遇到了这个错误。

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 中遇到了几个问题,因此它可能会导致不良行为。

发送

最佳答案

试试这个:

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

关于android - E/SQLiteLog: (10) Failed to do file read, got : 0, amt : 100, last Errno: 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29135397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com