1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

An attempt at cleaning up after the 3.00x and earlier bug that caused

K-9 to leave old headers hanging around in the database
This commit is contained in:
Jesse Vincent 2010-10-08 06:33:04 +00:00
parent ccc9a99d94
commit 8c1eda3149

View File

@ -44,7 +44,7 @@ public class LocalStore extends Store implements Serializable
*/ */
private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final int DB_VERSION = 38; private static final int DB_VERSION = 39;
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN, Flag.FLAGGED }; private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN, Flag.FLAGGED };
private String mPath; private String mPath;
@ -272,6 +272,19 @@ public class LocalStore extends Store implements Serializable
// Database version 38 is solely to prune cached attachments now that we clear them better // Database version 38 is solely to prune cached attachments now that we clear them better
if (mDb.getVersion() < 39)
{
try
{
mDb.execSQL("DELETE FROM headers WHERE id in (SELECT headers.id FROM headers LEFT JOIN messages ON headers.message_id = messages.id WHERE messages.id IS NULL)");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to remove extra header data from the database");
}
}
} }