mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Fix getFoldersAndUids() for threads
This commit is contained in:
parent
421558c148
commit
0a5a330820
@ -4326,8 +4326,8 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
* @param messageIds
|
* @param messageIds
|
||||||
* A list of primary keys in the "messages" table.
|
* A list of primary keys in the "messages" table.
|
||||||
* @param threadedList
|
* @param threadedList
|
||||||
* If this is {@code true}, {@code messageIds} contains the IDs of the messages at the
|
* If this is {@code true}, {@code messageIds} contains the thread IDs of the messages
|
||||||
* root of a thread. In that case return UIDs for all messages in these threads.
|
* at the root of a thread. In that case return UIDs for all messages in these threads.
|
||||||
* If this is {@code false} only the UIDs for messages in {@code messageIds} are
|
* If this is {@code false} only the UIDs for messages in {@code messageIds} are
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
@ -4358,25 +4358,26 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
|
|
||||||
if (threadedList) {
|
if (threadedList) {
|
||||||
String sql = "SELECT m.uid, f.name " +
|
String sql = "SELECT m.uid, f.name " +
|
||||||
"FROM messages h " +
|
"FROM threads t " +
|
||||||
"JOIN threads t1 ON (t1.message_id = h.id) " +
|
"LEFT JOIN messages m ON (t.message_id = m.id) " +
|
||||||
"JOIN threads t2 ON " +
|
"LEFT JOIN folders f ON (m.folder_id = f.id) " +
|
||||||
"(t1.root IN (t2.id, t2.root) OR t1.id IN (t2.id, t2.root)) " +
|
|
||||||
"JOIN messages m ON (t2.message_id = m.id) " +
|
|
||||||
"JOIN folders f ON (m.folder_id = f.id) " +
|
|
||||||
"WHERE (m.empty IS NULL OR m.empty != 1) AND m.deleted = 0 " +
|
"WHERE (m.empty IS NULL OR m.empty != 1) AND m.deleted = 0 " +
|
||||||
"AND h.id" + selectionSet;
|
"AND (t.id" + selectionSet + " OR t.root" + selectionSet + ")";
|
||||||
|
|
||||||
getDataFromCursor(db.rawQuery(sql, selectionArgs));
|
int len = selectionArgs.length;
|
||||||
|
String[] args = new String[len * 2];
|
||||||
|
System.arraycopy(selectionArgs, 0, args, 0, len);
|
||||||
|
System.arraycopy(selectionArgs, 0, args, len, len);
|
||||||
|
|
||||||
|
getDataFromCursor(db.rawQuery(sql, args));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String sqlPrefix =
|
String sql =
|
||||||
"SELECT m.uid, f.name " +
|
"SELECT m.uid, f.name " +
|
||||||
"FROM messages m " +
|
"FROM messages m " +
|
||||||
"JOIN folders f ON (m.folder_id = f.id) " +
|
"LEFT JOIN folders f ON (m.folder_id = f.id) " +
|
||||||
"WHERE (m.empty IS NULL OR m.empty != 1) AND ";
|
"WHERE (m.empty IS NULL OR m.empty != 1) AND m.id" + selectionSet;
|
||||||
|
|
||||||
String sql = sqlPrefix + "m.id" + selectionSet;
|
|
||||||
getDataFromCursor(db.rawQuery(sql, selectionArgs));
|
getDataFromCursor(db.rawQuery(sql, selectionArgs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user