Removed some code/string duplication.
This commit is contained in:
parent
6d4cc2825a
commit
3d27cf220a
1 changed files with 8 additions and 9 deletions
|
@ -2189,24 +2189,23 @@ public class LocalStore extends Store implements Serializable
|
|||
|
||||
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)
|
||||
};
|
||||
|
||||
open(OpenMode.READ_ONLY);
|
||||
Message[] messages = LocalStore.this.getMessages(
|
||||
null,
|
||||
this,
|
||||
"SELECT " + GET_MESSAGES_COLS
|
||||
+ "FROM messages WHERE folder_id = ? and date < ?", new String[]
|
||||
{
|
||||
Long.toString(mFolderId), Long.toString(cutoff)
|
||||
});
|
||||
"SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + where,
|
||||
params);
|
||||
|
||||
for (Message message : messages)
|
||||
{
|
||||
deleteAttachments(message.getUid());
|
||||
}
|
||||
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
|
||||
{
|
||||
Long.toString(mFolderId), new Long(cutoff)
|
||||
});
|
||||
mDb.execSQL("DELETE FROM messages WHERE " + where, params);
|
||||
resetUnreadAndFlaggedCounts();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue