当我从表中删除记录时,如何在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();
答案 0 :(得分:2)
这与greenDAO无关。如果磁盘已满,则表示已满。你的磁盘空间不足了。根据您的操作,偶尔运行VACUUM SQLite可能会对数据库进行碎片整理。
答案 1 :(得分:2)
来自SQLite文档
(13)SQLITE_FULL
SQLITE_FULL结果代码表示由于磁盘已满而无法完成写入。请注意,尝试将信息写入主数据库文件时可能会发生此错误,或者在写入临时磁盘文件时也会发生此错误。 有时,即使存在大量主磁盘空间,应用程序也会遇到此错误,因为在写入系统上的临时磁盘文件时会发生错误,临时文件存储在单独的分区上,而主磁盘的空间要小得多。 https://www.sqlite.org/rescode.html#full
我猜应用程序已安装在SDCARD或其他东西上。
答案 2 :(得分:0)
这是错误代码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使用的临时文件
您是否可能从服务器接收到太多数据?