Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2020-10-05 17:01:35 +0300
committerStefan Niedermann <info@niedermann.it>2020-10-05 17:01:35 +0300
commitb8048cb11b632bfbfbbf503650fe7557785b80a7 (patch)
tree134022332e7b6a0b4690214a71c37961883c25b3 /app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java
parentccdf700698593bd005cb954fa395bf7149ea86ed (diff)
#831 Migrate from SQLiteOpenHelper to Room
Fix some build bugs
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java
index 9fcdfd7b..136d1703 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java
@@ -4,6 +4,7 @@ import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -35,8 +36,8 @@ public interface NoteDao {
* @param accountId get the remoteIds from all notes of this account
* @return {@link Set<String>} remoteIds from all notes
*/
- @Query("SELECT remoteId FROM NoteEntity WHERE accountId = :accountId AND status != \"LOCAL_DELETED\"")
- Set<String> getRemoteIds(long accountId);
+ @Query("SELECT DISTINCT remoteId FROM NoteEntity WHERE accountId = :accountId AND status != \"LOCAL_DELETED\"")
+ List<Long> getRemoteIds(long accountId);
/**
@@ -45,9 +46,9 @@ public interface NoteDao {
* @param remoteId int - remote ID of the requested Note
* @return {@link DBNote#getId()}
*/
- @Query("SELECT id FROM noteentity WHERE accountId = :accountId AND remoteId = :remoteId AND status != \"LOCAL_DELETED\"")
+ @Query("SELECT id FROM NoteEntity WHERE accountId = :accountId AND remoteId = :remoteId AND status != \"LOCAL_DELETED\"")
Long getLocalIdByRemoteId(long accountId, long remoteId);
- @Query("SELECT favorite, COUNT(*) FROM noteentity WHERE status != \"LOCAL_DELETED\" AND accountId = :accountId GROUP BY favorite ORDER BY favorite")
+ @Query("SELECT favorite, COUNT(*) FROM NoteEntity WHERE status != \"LOCAL_DELETED\" AND accountId = :accountId GROUP BY favorite ORDER BY favorite")
Map<String, Integer> getFavoritesCount(long accountId);
}