make database function calls suspending and update room version

This commit is contained in:
Rohit Verma 2024-10-26 23:00:17 +05:30
parent bc065c8792
commit 249ed1c8dc
3 changed files with 13 additions and 13 deletions

View file

@ -15,19 +15,19 @@ abstract class NotForUploadStatusDao {
* Insert into Not For Upload status. * Insert into Not For Upload status.
*/ */
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
abstract fun insert(notForUploadStatus: NotForUploadStatus) abstract suspend fun insert(notForUploadStatus: NotForUploadStatus)
/** /**
* Delete Not For Upload status entry. * Delete Not For Upload status entry.
*/ */
@Delete @Delete
abstract fun delete(notForUploadStatus: NotForUploadStatus) abstract suspend fun delete(notForUploadStatus: NotForUploadStatus)
/** /**
* Query Not For Upload status with image sha1. * Query Not For Upload status with image sha1.
*/ */
@Query("SELECT * FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ") @Query("SELECT * FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
abstract fun getFromImageSHA1(imageSHA1: String): NotForUploadStatus? abstract suspend fun getFromImageSHA1(imageSHA1: String): NotForUploadStatus?
/** /**
* Asynchronous image sha1 query. * Asynchronous image sha1 query.
@ -38,7 +38,7 @@ abstract class NotForUploadStatusDao {
* Deletion Not For Upload status with image sha1. * Deletion Not For Upload status with image sha1.
*/ */
@Query("DELETE FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ") @Query("DELETE FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
abstract fun deleteWithImageSHA1(imageSHA1: String) abstract suspend fun deleteWithImageSHA1(imageSHA1: String)
/** /**
* Asynchronous image sha1 deletion. * Asynchronous image sha1 deletion.
@ -49,5 +49,5 @@ abstract class NotForUploadStatusDao {
* Check whether the imageSHA1 is present in database * Check whether the imageSHA1 is present in database
*/ */
@Query("SELECT COUNT() FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ") @Query("SELECT COUNT() FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
abstract fun find(imageSHA1: String): Int abstract suspend fun find(imageSHA1: String): Int
} }

View file

@ -17,31 +17,31 @@ abstract class UploadedStatusDao {
* Insert into uploaded status. * Insert into uploaded status.
*/ */
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
abstract fun insert(uploadedStatus: UploadedStatus) abstract suspend fun insert(uploadedStatus: UploadedStatus)
/** /**
* Update uploaded status entry. * Update uploaded status entry.
*/ */
@Update @Update
abstract fun update(uploadedStatus: UploadedStatus) abstract suspend fun update(uploadedStatus: UploadedStatus)
/** /**
* Delete uploaded status entry. * Delete uploaded status entry.
*/ */
@Delete @Delete
abstract fun delete(uploadedStatus: UploadedStatus) abstract suspend fun delete(uploadedStatus: UploadedStatus)
/** /**
* Query uploaded status with image sha1. * Query uploaded status with image sha1.
*/ */
@Query("SELECT * FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) ") @Query("SELECT * FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) ")
abstract fun getFromImageSHA1(imageSHA1: String): UploadedStatus? abstract suspend fun getFromImageSHA1(imageSHA1: String): UploadedStatus?
/** /**
* Query uploaded status with modified image sha1. * Query uploaded status with modified image sha1.
*/ */
@Query("SELECT * FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) ") @Query("SELECT * FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) ")
abstract fun getFromModifiedImageSHA1(modifiedImageSHA1: String): UploadedStatus? abstract suspend fun getFromModifiedImageSHA1(modifiedImageSHA1: String): UploadedStatus?
/** /**
* Asynchronous insert into uploaded status table. * Asynchronous insert into uploaded status table.
@ -55,7 +55,7 @@ abstract class UploadedStatusDao {
* Check whether the imageSHA1 is present in database * Check whether the imageSHA1 is present in database
*/ */
@Query("SELECT COUNT() FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) AND imageResult = (:imageResult) ") @Query("SELECT COUNT() FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) AND imageResult = (:imageResult) ")
abstract fun findByImageSHA1( abstract suspend fun findByImageSHA1(
imageSHA1: String, imageSHA1: String,
imageResult: Boolean, imageResult: Boolean,
): Int ): Int
@ -66,7 +66,7 @@ abstract class UploadedStatusDao {
@Query( @Query(
"SELECT COUNT() FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) AND modifiedImageResult = (:modifiedImageResult) ", "SELECT COUNT() FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) AND modifiedImageResult = (:modifiedImageResult) ",
) )
abstract fun findByModifiedImageSHA1( abstract suspend fun findByModifiedImageSHA1(
modifiedImageSHA1: String, modifiedImageSHA1: String,
modifiedImageResult: Boolean, modifiedImageResult: Boolean,
): Int ): Int

View file

@ -20,7 +20,7 @@ android.enableR8.fullMode=false
KOTLIN_VERSION=1.9.22 KOTLIN_VERSION=1.9.22
LEAK_CANARY_VERSION=2.10 LEAK_CANARY_VERSION=2.10
DAGGER_VERSION=2.23 DAGGER_VERSION=2.23
ROOM_VERSION=2.5.0 ROOM_VERSION=2.6.1
PREFERENCE_VERSION=1.1.0 PREFERENCE_VERSION=1.1.0
CORE_KTX_VERSION=1.9.0 CORE_KTX_VERSION=1.9.0
ADAPTER_DELEGATES_VERSION=4.3.0 ADAPTER_DELEGATES_VERSION=4.3.0