当我从表中删除记录时,如何解决 greenDao 中的 SQLiteFulException?
这是我的堆栈跟踪:
android.database.sqlite.SQLiteFullException: database or disk is full (code 13)
at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:555)
at android.database.sqlite.SQLiteSession.endTransactionUnchecked(SQLiteSession.java:437)
at android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:401)
at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:522)
at de.greenrobot.dao.AbstractDao.deleteInTxInternal(AbstractDao.java:613)
at de.greenrobot.dao.AbstractDao.deleteInTx(AbstractDao.java:623)
这是我从数据库删除记录的代码:
QueryBuilder<TaskD> qb = getTaskDDao(context).queryBuilder();
qb.where(TaskDDao.Properties.Uuid_task_h.eq(keyTaskH));
qb.build();
getTaskDDao(context).deleteInTx(qb.list());
getDaoSession(context).clear();
这与 greenDAO 无关。如果您的磁盘已满,则它已满。您的磁盘空间不足。根据您的操作,偶尔运行 VACUUM SQLite 可能会对您的数据库进行碎片整理。
来自 SQLite 文档
(13)SQLITE_FULL
SQLITE_FULL 结果代码表示写入无法完成,因为磁盘已满。请注意,尝试将信息写入主数据库文件时可能会发生此错误,或者写入临时磁盘文件时也可能会发生此错误。 有时,即使主磁盘空间充足,应用程序也会遇到此错误,因为在系统上写入临时磁盘文件时会发生此错误,其中临时文件存储在单独的分区上,且空间比主磁盘小得多。 https://www.sqlite.org/rescode.html#full
我猜应用程序安装在SDCARD或其他东西上。
这是错误代码列表https://www.sqlite.org/rescode.html
(13) SQLITE_FULL
The SQLITE_FULL result code indicates that a write could not complete because the
disk is full. Note that this error can occur when trying to write information into
the main database file, or it can also occur when writing into temporary disk files.
Sometimes applications encounter this error even though there is an abundance of
primary disk space because the error occurs when writing into temporary disk files on
a system where temporary files are stored on a separate partition with much less
space that the primary disk.`
这是sqlite使用的临时文件https://www.sqlite.org/tempfiles.html
您是否从服务器接收了太多数据?
清理应用程序数据并清除 Android 或 iOS 应用程序中的存储空间