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>2021-04-24 15:14:34 +0300
committerStefan Niedermann <info@niedermann.it>2021-04-26 11:47:11 +0300
commit9bcd67c2809039079331289c01a4facb8ca7efb1 (patch)
tree555083417841984ac7c274531d6fe5e4b1ef8f5f
parent4833d440b3d93d08a4fb323f190461473092ffa5 (diff)
Minor database optimization
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java1
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/dao/NoteDao.java6
2 files changed, 5 insertions, 2 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java
index 21c6ab5c..7a8be584 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java
@@ -408,7 +408,6 @@ public class NotesRepository {
return db.getNoteDao()
.getRemoteIdAndId(accountId)
.stream()
- .filter(note -> note.getRemoteId() != null)
.collect(toMap(Note::getRemoteId, Note::getId));
}
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 45979aa8..4585cb3d 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
@@ -138,7 +138,11 @@ public interface NoteDao {
@Query("SELECT DISTINCT remoteId FROM NOTE WHERE accountId = :accountId AND status != 'LOCAL_DELETED'")
List<Long> getRemoteIds(long accountId);
- @Query("SELECT id, remoteId, 0 as accountId, '' as title, 0 as favorite, '' as excerpt, 0 as modified, '' as eTag, 0 as status, '' as category, '' as content, 0 as scrollY FROM NOTE WHERE accountId = :accountId AND status != 'LOCAL_DELETED'")
+ /**
+ * Gets a list of {@link Note} objects with filled {@link Note#id} and {@link Note#remoteId},
+ * where {@link Note#remoteId} is not <code>null</code>
+ */
+ @Query("SELECT id, remoteId, 0 as accountId, '' as title, 0 as favorite, '' as excerpt, 0 as modified, '' as eTag, 0 as status, '' as category, '' as content, 0 as scrollY FROM NOTE WHERE accountId = :accountId AND status != 'LOCAL_DELETED' AND remoteId IS NOT NULL")
List<Note> getRemoteIdAndId(long accountId);
/**