Skip to content

Commit 16c791a

Browse files
committed
Upgrade DAO
1 parent cd1f0ec commit 16c791a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/hackware/mormont/notebook/db/dao/NotesDataDao.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import com.hackware.mormont.notebook.db.entity.NotesData
77
@Dao
88
interface NotesDataDao{
99

10-
@Query("SELECT * from NotesData")
10+
@Query("SELECT * from NotesData Order by created_date DESC ")
1111
fun getAll() : List<NotesData>
1212

1313
@Query ("SELECT * from NotesData WHERE note_id= :id LIMIT 1")
1414
fun loadNoteWithId(id: Long): NotesData
1515

16-
@Query("SELECT * FROM NotesData WHERE content LIKE :query")
16+
@Query("SELECT * FROM NotesData WHERE (content LIKE :query) or (title Like :query)")
1717
fun getNotesForQuery(query: String): LiveData<List<NotesData>>
1818

1919
@Insert(onConflict = OnConflictStrategy.REPLACE)

0 commit comments

Comments
 (0)