google-research / CVD-paper-mobile-camera-example

Apache License 2.0
37 stars 9 forks source link

Fixes for UNIQUE constraint failure exception #129

Open khyativyasargus opened 3 days ago

khyativyasargus commented 3 days ago

Handled recapture case when we reopen media capture form for an existing patient without submitting the previous form - fixes for UNIQUE constraint failure exception in such case

For Example :

android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: CaptureInfoEntity.captureFolder (code 2067 SQLITE_CONSTRAINT_UNIQUE[2067]) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:1293) at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790) at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:89) at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42) at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.kt:52) at com.google.android.sensing.db.impl.dao.CaptureInfoDao_Impl$3.call(CaptureInfoDao_Impl.java:106) at com.google.android.sensing.db.impl.dao.CaptureInfoDao_Impl$3.call(CaptureInfoDao_Impl.java:101) at androidx.room.CoroutinesRoom$Companion.execute(CoroutinesRoom.kt:57) at androidx.room.CoroutinesRoom.execute(Unknown Source:2) at com.google.android.sensing.db.impl.dao.CaptureInfoDao_Impl.insertCaptureInfoEntity(CaptureInfoDao_Impl.java:101) at com.google.android.sensing.db.impl.dao.CaptureInfoDao.insertCaptureInfo$suspendImpl(CaptureInfoDao.kt:36) at com.google.android.sensing.db.impl.dao.CaptureInfoDao.insertCaptureInfo(Unknown Source:0) at com.google.android.sensing.db.impl.dao.CaptureInfoDao_Impl.access$601(CaptureInfoDao_Impl.java:36) at com.google.android.sensing.db.impl.dao.CaptureInfoDao_Impl.lambda$insertCaptureInfo$0$com-google-android-sensing-db-impl-dao-CaptureInfoDao_Impl(CaptureInfoDao_Impl.java:119) at com.google.android.sensing.db.impl.dao.CaptureInfoDao_Impl$$ExternalSyntheticLambda0.invoke(Unknown Source:6) at androidx.room.RoomDatabaseKt$withTransaction$transactionBlock$1.invokeSuspend(RoomDatabaseExt.kt:56) at androidx.room.RoomDatabaseKt$withTransaction$transactionBlock$1.invoke(Unknown Source:8) at androidx.room.RoomDatabaseKt$withTransaction$transactionBlock$1.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:169) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at androidx.room.RoomDatabaseKt$startTransactionCoroutine$2$1$1.invokeSuspend(RoomDatabaseExt.kt:97) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1) at androidx.room.RoomDatabaseKt$startTransactionCoroutine$2$1.run(RoomDatabaseExt.kt:93) at androidx.room.TransactionExecutor.execute$lambda$1$lambda$0(TransactionExecutor.kt:36) at androidx.room.TransactionExecutor.$r8$lambda$AympDHYBb78s7_N_9gRsXF0sHiw(Unknown Source:0) at androidx.room.TransactionExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@29afe57, Dispatchers.IO]