From dd6c9ce2feee28b5535e864f27bbc088ac009a99 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 31 Oct 2022 17:34:19 -0400 Subject: [PATCH] Avoid crashing if multiple entries exist for same URL/source Related to #8331. We'll need to revisit some of the get/insert logic to make sure this doesn't actually happen, but at least it'll stop crashing for now. --- app/src/main/sqldelight/data/mangas.sq | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/sqldelight/data/mangas.sq b/app/src/main/sqldelight/data/mangas.sq index 11bac32e3..ccdec3621 100644 --- a/app/src/main/sqldelight/data/mangas.sq +++ b/app/src/main/sqldelight/data/mangas.sq @@ -32,10 +32,12 @@ SELECT * FROM mangas WHERE _id = :id; +-- TODO: this should ideally never really have more than 1 result getMangaByUrlAndSource: SELECT * FROM mangas -WHERE url = :url AND source = :source; +WHERE url = :url AND source = :source +LIMIT 1; getFavorites: SELECT *