mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:21:51 +01:00
Fixed sql query crash
This commit is contained in:
parent
257b28141e
commit
2c7ceb900b
@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.database.resolvers.ChapterSourceOrderPutResolver
|
||||
import eu.kanade.tachiyomi.data.database.resolvers.MangaChapterGetResolver
|
||||
import eu.kanade.tachiyomi.data.database.resolvers.MangaChapterHistoryGetResolver
|
||||
import eu.kanade.tachiyomi.data.database.tables.ChapterTable
|
||||
import eu.kanade.tachiyomi.util.lang.sqLite
|
||||
import java.util.Date
|
||||
|
||||
interface ChapterQueries : DbProvider {
|
||||
@ -39,7 +40,7 @@ interface ChapterQueries : DbProvider {
|
||||
fun getUpdatedManga(date: Date, search: String = "", endless: Boolean) = db.get()
|
||||
.listOfObjects(MangaChapterHistory::class.java)
|
||||
.withQuery(RawQuery.builder()
|
||||
.query(getRecentsQueryDistinct(search, endless))
|
||||
.query(getRecentsQueryDistinct(search.sqLite, endless))
|
||||
.args(date.time)
|
||||
.observesTables(ChapterTable.TABLE)
|
||||
.build())
|
||||
|
@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.data.database.resolvers.HistoryLastReadPutResolver
|
||||
import eu.kanade.tachiyomi.data.database.resolvers.MangaChapterHistoryGetResolver
|
||||
import eu.kanade.tachiyomi.data.database.tables.HistoryTable
|
||||
import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
||||
import eu.kanade.tachiyomi.util.lang.sqLite
|
||||
import java.util.Date
|
||||
|
||||
interface HistoryQueries : DbProvider {
|
||||
@ -27,7 +28,7 @@ interface HistoryQueries : DbProvider {
|
||||
fun getRecentManga(date: Date, offset: Int = 0, search: String = "") = db.get()
|
||||
.listOfObjects(MangaChapterHistory::class.java)
|
||||
.withQuery(RawQuery.builder()
|
||||
.query(getRecentMangasQuery(offset, search))
|
||||
.query(getRecentMangasQuery(offset, search.sqLite))
|
||||
.args(date.time)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build())
|
||||
@ -42,7 +43,7 @@ interface HistoryQueries : DbProvider {
|
||||
fun getRecentlyAdded(date: Date, search: String = "", endless: Boolean) = db.get()
|
||||
.listOfObjects(MangaChapterHistory::class.java)
|
||||
.withQuery(RawQuery.builder()
|
||||
.query(getRecentAdditionsQuery(search, endless))
|
||||
.query(getRecentAdditionsQuery(search.sqLite, endless))
|
||||
.args(date.time)
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build())
|
||||
@ -57,7 +58,7 @@ interface HistoryQueries : DbProvider {
|
||||
fun getRecentMangaLimit(date: Date, limit: Int = 0, search: String = "") = db.get()
|
||||
.listOfObjects(MangaChapterHistory::class.java)
|
||||
.withQuery(RawQuery.builder()
|
||||
.query(getRecentMangasLimitQuery(limit, search))
|
||||
.query(getRecentMangasLimitQuery(limit, search.sqLite))
|
||||
.args(date.time)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build())
|
||||
@ -72,7 +73,7 @@ interface HistoryQueries : DbProvider {
|
||||
fun getRecentsWithUnread(date: Date, search: String = "", endless: Boolean) = db.get()
|
||||
.listOfObjects(MangaChapterHistory::class.java)
|
||||
.withQuery(RawQuery.builder()
|
||||
.query(getRecentReadWithUnreadChapters(search, endless))
|
||||
.query(getRecentReadWithUnreadChapters(search.sqLite, endless))
|
||||
.args(date.time)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build())
|
||||
|
@ -22,6 +22,9 @@ fun String.removeArticles(): String {
|
||||
}
|
||||
}
|
||||
|
||||
val String.sqLite:String
|
||||
get() = replace("'", "''")
|
||||
|
||||
fun String.trimOrNull(): String? {
|
||||
val trimmed = trim()
|
||||
return if (trimmed.isBlank()) null else trimmed
|
||||
|
Loading…
Reference in New Issue
Block a user