Skip to content

Commit

Permalink
Merge branch 'current-stable' into mysword-support
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Feb 2, 2023
2 parents 074d10d + 114fb95 commit 60992f0
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions app/src/main/java/net/bible/service/sword/mybible/MyBibleBook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,16 @@ class SqliteBackend(val state: SqliteVerseBackendState, metadata: SwordBookMetaD
val verse = KeyUtil.getVerse(that)
state.sqlDb.rawQuery(
"""select _rowid_ from commentaries WHERE book_number = ? AND
((chapter_number_from <= ? AND verse_number_from <= ? AND
chapter_number_to >= ? AND verse_number_to >= ?) OR
(chapter_number_from = ? AND verse_number_from = ? AND chapter_number_to IS NULL AND verse_number_to IS NULL))
(
(chapter_number_from <= ? AND verse_number_from <= ? AND
chapter_number_to >= ? AND verse_number_to >= ?
)
OR
(chapter_number_from = ? AND verse_number_from = ? AND
(chapter_number_to IS NULL OR chapter_number_to = 0) AND
(verse_number_to IS NULL OR verse_number_to = 0
)
))
""",
arrayOf("${bibleBookToMyBibleInt[verse.book]}", "${verse.chapter}", "${verse.verse}", "${verse.chapter}", "${verse.verse}", "${verse.chapter}", "${verse.verse}")).use {

Expand Down Expand Up @@ -329,10 +335,18 @@ class SqliteBackend(val state: SqliteVerseBackendState, metadata: SwordBookMetaD
private fun readCommentary(state: SqliteVerseBackendState, key: Key): String {
val verse = KeyUtil.getVerse(key)
return state.sqlDb.rawQuery(
"""select text from commentaries WHERE book_number = ? AND
((chapter_number_from <= ? AND verse_number_from <= ? AND
chapter_number_to >= ? AND verse_number_to >= ?) OR
(chapter_number_from = ? AND verse_number_from = ? AND chapter_number_to IS NULL AND verse_number_to IS NULL))
"""select text from commentaries WHERE
book_number = ? AND
(
(chapter_number_from <= ? AND verse_number_from <= ? AND
chapter_number_to >= ? AND verse_number_to >= ?
)
OR
(chapter_number_from = ? AND verse_number_from = ? AND
(chapter_number_to IS NULL OR chapter_number_to = 0) AND
(verse_number_to IS NULL OR verse_number_to = 0
)
))
""",
arrayOf("${bibleBookToMyBibleInt[verse.book]}", "${verse.chapter}", "${verse.verse}", "${verse.chapter}", "${verse.verse}", "${verse.chapter}", "${verse.verse}")
).use {
Expand Down

0 comments on commit 60992f0

Please sign in to comment.