diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-09-25 13:51:45 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-09-25 13:51:45 +0200 |
commit | e206d1571f1deb27ba8f176487e046a130613472 (patch) | |
tree | a90de463c5a76d28052dd19454abc20aae337a77 /src | |
parent | 88b3a015cd9cd4f793f0aaa984b878bb94303ae4 (diff) | |
download | AntennaPod-e206d1571f1deb27ba8f176487e046a130613472.zip |
delete chapters when removing item from db
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/storage/PodDBAdapter.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/de/danoeh/antennapod/storage/PodDBAdapter.java b/src/de/danoeh/antennapod/storage/PodDBAdapter.java index cd95c16df..8254fe69d 100644 --- a/src/de/danoeh/antennapod/storage/PodDBAdapter.java +++ b/src/de/danoeh/antennapod/storage/PodDBAdapter.java @@ -144,8 +144,7 @@ public class PodDBAdapter { + " INTEGER," + KEY_READ + " INTEGER," + KEY_LINK + " TEXT," + KEY_DESCRIPTION + " TEXT," + KEY_PAYMENT_LINK + " TEXT," + KEY_MEDIA + " INTEGER," + KEY_FEED + " INTEGER," - + KEY_HAS_CHAPTERS + " INTEGER," + KEY_ITEM_IDENTIFIER - + " TEXT)"; + + KEY_HAS_CHAPTERS + " INTEGER," + KEY_ITEM_IDENTIFIER + " TEXT)"; private static final String CREATE_TABLE_FEED_IMAGES = "CREATE TABLE " + TABLE_NAME_FEED_IMAGES + " (" + TABLE_PRIMARY_KEY + KEY_TITLE @@ -412,6 +411,11 @@ public class PodDBAdapter { new String[] { String.valueOf(media.getId()) }); } + public void removeChaptersOfItem(FeedItem item) { + db.delete(TABLE_NAME_SIMPLECHAPTERS, KEY_FEEDITEM + "=?", + new String[] { String.valueOf(item.getId()) }); + } + public void removeFeedImage(FeedImage image) { db.delete(TABLE_NAME_FEED_IMAGES, KEY_ID + "=?", new String[] { String.valueOf(image.getId()) }); @@ -422,6 +426,9 @@ public class PodDBAdapter { if (item.getMedia() != null) { removeFeedMedia(item.getMedia()); } + if (item.getChapters() != null) { + removeChaptersOfItem(item); + } db.delete(TABLE_NAME_FEED_ITEMS, KEY_ID + "=?", new String[] { String.valueOf(item.getId()) }); } |