Some cleanup on DBReader:

- Taking more care of closing adapter and cursors.
- Dropping unneeded MoveToFirst where we manage the cursor.
- Better feed association implementation.
- Dropping one of getFeedItems() methods that looks unused.
This commit is contained in:
Danial Klimkin 2017-04-22 12:03:32 +02:00
parent 98001b51d9
commit 6eba46a7ba
2 changed files with 442 additions and 383 deletions

View File

@ -1156,7 +1156,9 @@ public class PodDBAdapter {
+ TABLE_NAME_FEED_IMAGES + " WHERE " + KEY_ID + " IN "
+ buildInOperator(neededLength), parts);
}
return new MergeCursor(cursors);
Cursor result = new MergeCursor(cursors);
result.moveToFirst();
return result;
} else {
return db.query(TABLE_NAME_FEED_IMAGES, null, KEY_ID + " IN "
+ buildInOperator(length), imageIds, null, null, null);
@ -1341,7 +1343,9 @@ public class PodDBAdapter {
+ TABLE_NAME_FEED_MEDIA + " WHERE " + KEY_FEEDITEM + " IN "
+ buildInOperator(neededLength), parts);
}
return new MergeCursor(cursors);
Cursor result = new MergeCursor(cursors);
result.moveToFirst();
return result;
} else {
return db.query(TABLE_NAME_FEED_MEDIA, null, KEY_FEEDITEM + " IN "
+ buildInOperator(length), itemIds, null, null, null);