summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-08-30 19:23:11 +0200
committerByteHamster <info@bytehamster.com>2022-08-30 19:23:11 +0200
commit836e2199bc609863332a1d85e2f29094d515491a (patch)
tree421e0f2cb414c941d7186ca0fed3951b9110ee34 /storage
parent4c88a1aa69b698284ab0f70e55f059bcd514e654 (diff)
downloadAntennaPod-836e2199bc609863332a1d85e2f29094d515491a.zip
Load only favorite IDs instead of whole FeedItems
Diffstat (limited to 'storage')
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java
index 42517e972..f4fff808d 100644
--- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java
+++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java
@@ -1005,27 +1005,21 @@ public class PodDBAdapter {
return db.rawQuery(query, null);
}
- public final Cursor getFavoritesCursor(int offset, int limit) {
- final String query = SELECT_FEED_ITEMS_AND_MEDIA
+ public final Cursor getFavoritesIdsCursor(int offset, int limit) {
+ // Way faster than selecting all columns
+ final String query = "SELECT " + TABLE_NAME_FEED_ITEMS + "." + KEY_ID
+ + " FROM " + TABLE_NAME_FEED_ITEMS
+ " INNER JOIN " + TABLE_NAME_FAVORITES
- + " ON " + SELECT_KEY_ITEM_ID + " = " + TABLE_NAME_FAVORITES + "." + KEY_FEEDITEM
+ + " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + " = " + TABLE_NAME_FAVORITES + "." + KEY_FEEDITEM
+ " ORDER BY " + TABLE_NAME_FEED_ITEMS + "." + KEY_PUBDATE + " DESC"
+ " LIMIT " + offset + ", " + limit;
return db.rawQuery(query, null);
}
- public void setFeedItems(int state) {
- setFeedItems(Integer.MIN_VALUE, state, 0);
- }
-
public void setFeedItems(int oldState, int newState) {
setFeedItems(oldState, newState, 0);
}
- public void setFeedItems(int state, long feedId) {
- setFeedItems(Integer.MIN_VALUE, state, feedId);
- }
-
public void setFeedItems(int oldState, int newState, long feedId) {
String sql = "UPDATE " + TABLE_NAME_FEED_ITEMS + " SET " + KEY_READ + "=" + newState;
if (feedId > 0) {