Merge pull request #1423 from TomHennen/clear_database
just clear the database tables, don't delete the whole DB.
This commit is contained in:
commit
4bc0faf949
|
@ -263,6 +263,20 @@ public class PodDBAdapter {
|
||||||
TABLE_NAME_FEED_ITEMS + "." + KEY_AUTO_DOWNLOAD
|
TABLE_NAME_FEED_ITEMS + "." + KEY_AUTO_DOWNLOAD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Contains FEEDITEM_SEL_FI_SMALL as comma-separated list. Useful for raw queries.
|
||||||
*/
|
*/
|
||||||
|
@ -325,15 +339,13 @@ public class PodDBAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean deleteDatabase() {
|
public static boolean deleteDatabase() {
|
||||||
if(dbHelper != null) {
|
PodDBAdapter adapter = getInstance();
|
||||||
dbHelper.close();
|
adapter.open();
|
||||||
dbHelper = null;
|
for (String tableName : ALL_TABLES) {
|
||||||
}
|
db.delete(tableName, "1", null);
|
||||||
if(context != null) { // may not have been initialized
|
|
||||||
return context.deleteDatabase(PodDBAdapter.DATABASE_NAME);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
adapter.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue