diff options
author | Tom Hennen <tom.hennen@gmail.com> | 2015-11-27 09:22:50 -0500 |
---|---|---|
committer | Tom Hennen <tom.hennen@gmail.com> | 2015-11-27 09:22:50 -0500 |
commit | b5ea846bb1f179d8d6830087577c68b8945ffdc5 (patch) | |
tree | e51ec72d26e52d9e2d5cba70b98f975bade30fd9 /core | |
parent | 69038b4ff5fad16407ef7401202539113746dcf9 (diff) | |
download | AntennaPod-b5ea846bb1f179d8d6830087577c68b8945ffdc5.zip |
just clear the database tables, don't delete the whole DB.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index c67fb956a..bf324c9d1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -264,6 +264,20 @@ public class PodDBAdapter { }; /** + * All the tables in the database + */ + private static final String[] ALL_TABLES = { + TABLE_NAME_FEEDS, + TABLE_NAME_FEED_ITEMS, + TABLE_NAME_FEED_IMAGES, + TABLE_NAME_FEED_MEDIA, + TABLE_NAME_DOWNLOAD_LOG, + TABLE_NAME_QUEUE, + TABLE_NAME_SIMPLECHAPTERS, + TABLE_NAME_FAVORITES + }; + + /** * Contains FEEDITEM_SEL_FI_SMALL as comma-separated list. Useful for raw queries. */ private static final String SEL_FI_SMALL_STR; @@ -325,15 +339,13 @@ public class PodDBAdapter { } public static boolean deleteDatabase() { - if(dbHelper != null) { - dbHelper.close(); - dbHelper = null; - } - if(context != null) { // may not have been initialized - return context.deleteDatabase(PodDBAdapter.DATABASE_NAME); - } else { - return false; + PodDBAdapter adapter = getInstance(); + adapter.open(); + for (String tableName : ALL_TABLES) { + db.delete(tableName, "1", null); } + adapter.close(); + return true; } /** |