gpt4 book ai didi

java - SQLite VACUUM 命令

转载 作者:太空狗 更新时间:2023-10-29 13:24:28 27 4
gpt4 key购买 nike

正常情况下,我正在使用我的应用程序,超过 30000 次下载没有问题。但我看到此错误开始出现在 android 开发人员控制台(崩溃和 ANRS) 中。

by app version 3.1.1 1 100.0%

by Android version Android 2.3.3 - 2.3.7 1 100.0%

by device Blade (blade)

这是我的代码:

public  void deletetable(String Tablename){
SQLiteDatabase db = mContext.openOrCreateDatabase(DB_NAME,
Context.MODE_PRIVATE, null);
db.delete(Tablename, null, null);
db.execSQL("VACUUM");
}

这是报告:

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
Caused by: android.database.sqlite.SQLiteDiskIOException: disk I/O error: VACUUM
at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1763)
at com.restroomgames.kpss.TestAdapter.deletetable(TestAdapter.java:194)
at com.restroomgames.kpss.TrGenelSinavAnasayfa.yenile(TrGenelSinavAnasayfa.java:395)
at com.restroomgames.kpss.TrGenelSinavAnasayfa$refreshyazi.doInBackground(TrGenelSinavAnasayfa.java:381)
at com.restroomgames.kpss.TrGenelSinavAnasayfa$refreshyazi.doInBackground(TrGenelSinavAnasayfa.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
... 4 more

最佳答案

来自 VACUUM 文档:

The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file. When overwriting the original, a rollback journal or write-ahead log WAL file is used just as it would be for any other database transaction. This means that when VACUUMing a database, as much as twice the size of the original database file is required in free disk space.

It may be that there is not enough free space available on disk to perform the VACUUM operation.
http://sqlite.org/lang_vacuum.html

关于java - SQLite VACUUM 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23053462/

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