Loading src/com/fsck/k9/mail/store/LocalStore.java +15 −9 Original line number Diff line number Diff line Loading @@ -3438,19 +3438,13 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati throw new MessagingException("Cannot call getUidFromMessageId on LocalFolder"); } public void deleteMessagesOlderThan(long cutoff) throws MessagingException private void deleteMessagesWhere(final String whereClause, final String[] params) throws MessagingException { final String where = "folder_id = ? and date < ?"; final String[] params = new String[] { Long.toString(mFolderId), Long.toString(cutoff) }; open(OpenMode.READ_ONLY); Message[] messages = LocalStore.this.getMessages( null, this, "SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + where, "SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + whereClause, params); for (Message message : messages) Loading @@ -3462,13 +3456,25 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati @Override public Void doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException { db.execSQL("DELETE FROM messages WHERE " + where, params); db.execSQL("DELETE FROM messages WHERE " + whereClause, params); return null; } }); resetUnreadAndFlaggedCounts(); } public void deleteMessagesOlderThan(long cutoff) throws MessagingException { final String where = "folder_id = ? and date < ?"; final String[] params = new String[] { Long.toString(mFolderId), Long.toString(cutoff) }; deleteMessagesWhere(where, params); } private void resetUnreadAndFlaggedCounts() { try Loading Loading
src/com/fsck/k9/mail/store/LocalStore.java +15 −9 Original line number Diff line number Diff line Loading @@ -3438,19 +3438,13 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati throw new MessagingException("Cannot call getUidFromMessageId on LocalFolder"); } public void deleteMessagesOlderThan(long cutoff) throws MessagingException private void deleteMessagesWhere(final String whereClause, final String[] params) throws MessagingException { final String where = "folder_id = ? and date < ?"; final String[] params = new String[] { Long.toString(mFolderId), Long.toString(cutoff) }; open(OpenMode.READ_ONLY); Message[] messages = LocalStore.this.getMessages( null, this, "SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + where, "SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + whereClause, params); for (Message message : messages) Loading @@ -3462,13 +3456,25 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati @Override public Void doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException { db.execSQL("DELETE FROM messages WHERE " + where, params); db.execSQL("DELETE FROM messages WHERE " + whereClause, params); return null; } }); resetUnreadAndFlaggedCounts(); } public void deleteMessagesOlderThan(long cutoff) throws MessagingException { final String where = "folder_id = ? and date < ?"; final String[] params = new String[] { Long.toString(mFolderId), Long.toString(cutoff) }; deleteMessagesWhere(where, params); } private void resetUnreadAndFlaggedCounts() { try Loading