I'm trying to delete a row from my database based on Room in my android app. When user delete a row from the database, the operation is successful. But, when the user deletes another row, the app crashes. If the user deletes a row and then restarts the app to delete another row, the delete operation works fine.
Here's the log:
E/SQLiteLog: (1) no such table: room_table_modification_log
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #6
Process: com.basusingh.blingoo, PID: 18469
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalStateException: The database '/data/user/0/com.basusingh.blingoo/databases/wordLayList' is not open.
at android.database.sqlite.SQLiteDatabase.throwIfNotOpenLocked(SQLiteDatabase.java:2943)
at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:564)
at android.database.sqlite.-$$Lambda$RBWjWVyGrOTsQrLCYzJ_G8Uk25Q.get(Unknown Source:2)
at java.lang.ThreadLocal$SuppliedThreadLocal.initialValue(ThreadLocal.java:284)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180)
at java.lang.ThreadLocal.get(ThreadLocal.java:170)
at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:558)
at android.database.sqlite.SQLiteProgram.getSession(SQLiteProgram.java:123)
at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:64)
at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeUpdateDelete(FrameworkSQLiteStatement.java:46)
at com.basusingh.blingoo.Database.WordLayList.WordLayListDao_Impl.DeleteWordLayList(WordLayListDao_Impl.java:94)
at com.basusingh.blingoo.Activity.WordLayListViewer$1doTask.doInBackground(WordLayListViewer.java:156)
at com.basusingh.blingoo.Activity.WordLayListViewer$1doTask.doInBackground(WordLayListViewer.java:148)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
E/ROOM: Cannot run invalidation tracker. Is the db closed?
android.database.sqlite.SQLiteException: no such table: room_table_modification_log (code 1 SQLITE_ERROR[1]): , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1;
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1229)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:703)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1865)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1840)
at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.query(FrameworkSQLiteDatabase.java:161)
at androidx.room.RoomDatabase.query(RoomDatabase.java:328)
at androidx.room.RoomDatabase.query(RoomDatabase.java:311)
at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:415)
at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:389)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Here's the DAO code:
@Dao
public interface WordLayListDao {
@Query("DELETE FROM WordLayListItems WHERE uid = :id")
void DeleteWordLayList(int id);
}
from Room Database : Multiple delete query crashes app
No comments:
Post a Comment