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