mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-28 17:19:00 +03:00
Remove deprecated calls and fix a potential race condition
This commit is contained in:
parent
33b04427d5
commit
1090c04fe3
5 changed files with 11 additions and 11 deletions
|
@ -3,23 +3,23 @@ package eu.kanade.tachiyomi.data.database
|
|||
import com.pushtorefresh.storio.sqlite.StorIOSQLite
|
||||
|
||||
inline fun StorIOSQLite.inTransaction(block: () -> Unit) {
|
||||
internal().beginTransaction()
|
||||
lowLevel().beginTransaction()
|
||||
try {
|
||||
block()
|
||||
internal().setTransactionSuccessful()
|
||||
lowLevel().setTransactionSuccessful()
|
||||
} finally {
|
||||
internal().endTransaction()
|
||||
lowLevel().endTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T> StorIOSQLite.inTransactionReturn(block: () -> T): T {
|
||||
internal().beginTransaction()
|
||||
lowLevel().beginTransaction()
|
||||
try {
|
||||
val result = block()
|
||||
internal().setTransactionSuccessful()
|
||||
lowLevel().setTransactionSuccessful()
|
||||
return result
|
||||
} finally {
|
||||
internal().endTransaction()
|
||||
lowLevel().endTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class ChapterProgressPutResolver : PutResolver<Chapter>() {
|
|||
val updateQuery = mapToUpdateQuery(chapter)
|
||||
val contentValues = mapToContentValues(chapter)
|
||||
|
||||
val numberOfRowsUpdated = db.internal().update(updateQuery, contentValues)
|
||||
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
|
||||
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class ChapterSourceOrderPutResolver : PutResolver<Chapter>() {
|
|||
val updateQuery = mapToUpdateQuery(chapter)
|
||||
val contentValues = mapToContentValues(chapter)
|
||||
|
||||
val numberOfRowsUpdated = db.internal().update(updateQuery, contentValues)
|
||||
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
|
||||
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
||||
}
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@ class HistoryLastReadPutResolver : PutResolver<History>() {
|
|||
val contentValues = mapToContentValues(history)
|
||||
|
||||
// Execute query
|
||||
val numberOfRowsUpdated = db.internal().update(updateQuery, contentValues)
|
||||
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
|
||||
|
||||
// If chapter not found in history insert into database
|
||||
if (numberOfRowsUpdated == 0) {
|
||||
db.put().`object`(history).prepare().asRxObservable().subscribe()
|
||||
db.put().`object`(history).prepare().executeAsBlocking()
|
||||
}
|
||||
// Update result
|
||||
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
||||
|
|
|
@ -15,7 +15,7 @@ class MangaFlagsPutResolver : PutResolver<Manga>() {
|
|||
val updateQuery = mapToUpdateQuery(manga)
|
||||
val contentValues = mapToContentValues(manga)
|
||||
|
||||
val numberOfRowsUpdated = db.internal().update(updateQuery, contentValues)
|
||||
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
|
||||
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue