pull/36/head
kunfei 5 years ago
parent 5c41348cb5
commit 149dd41544
  1. 2
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 2
      app/src/main/java/io/legado/app/data/dao/SearchKeywordDao.kt

@ -24,7 +24,7 @@ interface BookDao {
@Query("SELECT bookUrl FROM books WHERE `group` = :group") @Query("SELECT bookUrl FROM books WHERE `group` = :group")
fun observeUrlsByGroup(group: Int): LiveData<List<String>> fun observeUrlsByGroup(group: Int): LiveData<List<String>>
@Query("SELECT bookUrl FROM books WHERE name like '%' | :key | '%' or author like '%' | :key | '%'") @Query("SELECT bookUrl FROM books WHERE name like '%' || :key || '%' or author like '%' || :key || '%'")
fun liveDataSearch(key: String): LiveData<List<Book>> fun liveDataSearch(key: String): LiveData<List<Book>>
@Query("SELECT * FROM books WHERE `name` in (:names)") @Query("SELECT * FROM books WHERE `name` in (:names)")

@ -14,7 +14,7 @@ interface SearchKeywordDao {
@Query("SELECT * FROM search_keywords ORDER BY lastUseTime DESC") @Query("SELECT * FROM search_keywords ORDER BY lastUseTime DESC")
fun liveDataByTime(): LiveData<List<SearchKeyword>> fun liveDataByTime(): LiveData<List<SearchKeyword>>
@Query("SELECT * FROM search_keywords where word like '%' | :key | '%' ORDER BY usage DESC") @Query("SELECT * FROM search_keywords where word like '%' || :key || '%' ORDER BY usage DESC")
fun liveDataSearch(key: String): LiveData<List<SearchKeyword>> fun liveDataSearch(key: String): LiveData<List<SearchKeyword>>
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)

Loading…
Cancel
Save