mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-06 04:45:50 +01:00
Revert "Reduce number of invalidations"
This reverts commit 845eff88b4.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"formatVersion": 1,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 87,
|
"version": 87,
|
||||||
"identityHash": "54e4606798a2b98908f5ba9b31401294",
|
"identityHash": "2329269ef351fecd73eff3e3a525e658",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "identity",
|
"tableName": "identity",
|
||||||
@@ -1773,27 +1773,10 @@
|
|||||||
"foreignKeys": []
|
"foreignKeys": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"views": [
|
"views": [],
|
||||||
{
|
|
||||||
"viewName": "accountprop",
|
|
||||||
"createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, name, color, synchronize, `primary`, notify, browse, swipe_left, swipe_right, created, `order` FROM account"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"viewName": "folderprop",
|
|
||||||
"createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, account, name, type, download, display, unified, notify FROM folder"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"viewName": "attachmentprop",
|
|
||||||
"createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, message, name FROM attachment"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"viewName": "operationprop",
|
|
||||||
"createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, folder, message, name FROM operation"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"setupQueries": [
|
"setupQueries": [
|
||||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '54e4606798a2b98908f5ba9b31401294')"
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2329269ef351fecd73eff3e3a525e658')"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,6 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
|
|||||||
EntityLog.class
|
EntityLog.class
|
||||||
},
|
},
|
||||||
views = {
|
views = {
|
||||||
EntityAccountProp.class,
|
|
||||||
EntityFolderProp.class,
|
|
||||||
EntityAttachmentProp.class,
|
|
||||||
EntityOperationProp.class
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -871,14 +867,6 @@ public abstract class DB extends RoomDatabase {
|
|||||||
public void migrate(SupportSQLiteDatabase db) {
|
public void migrate(SupportSQLiteDatabase db) {
|
||||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||||
db.execSQL("DROP VIEW `folderview`");
|
db.execSQL("DROP VIEW `folderview`");
|
||||||
db.execSQL("CREATE VIEW `accountprop` AS " +
|
|
||||||
"SELECT id, name, color, synchronize, `primary`, notify, browse, swipe_left, swipe_right, created, `order` FROM account");
|
|
||||||
db.execSQL("CREATE VIEW `folderprop` AS " +
|
|
||||||
"SELECT id, account, name, type, download, display, unified, notify FROM folder");
|
|
||||||
db.execSQL("CREATE VIEW `attachmentprop` AS " +
|
|
||||||
"SELECT id, message, name FROM attachment");
|
|
||||||
db.execSQL("CREATE VIEW `operationprop` AS " +
|
|
||||||
"SELECT id, folder, message, name FROM operation");
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public interface DaoAccount {
|
|||||||
@Query("SELECT account.*" +
|
@Query("SELECT account.*" +
|
||||||
", (SELECT COUNT(message.id)" +
|
", (SELECT COUNT(message.id)" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" WHERE message.account = account.id" +
|
" WHERE message.account = account.id" +
|
||||||
" AND folder.type <> '" + EntityFolder.ARCHIVE + "'" +
|
" AND folder.type <> '" + EntityFolder.ARCHIVE + "'" +
|
||||||
" AND folder.type <> '" + EntityFolder.TRASH + "'" +
|
" AND folder.type <> '" + EntityFolder.TRASH + "'" +
|
||||||
@@ -60,7 +60,7 @@ public interface DaoAccount {
|
|||||||
" AND identity.synchronize) AS identities" +
|
" AND identity.synchronize) AS identities" +
|
||||||
", CASE WHEN drafts.id IS NULL THEN 0 ELSE 1 END AS drafts" +
|
", CASE WHEN drafts.id IS NULL THEN 0 ELSE 1 END AS drafts" +
|
||||||
" FROM account" +
|
" FROM account" +
|
||||||
" LEFT JOIN folderprop AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" +
|
" LEFT JOIN folder AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" +
|
||||||
" WHERE :all OR account.synchronize" +
|
" WHERE :all OR account.synchronize" +
|
||||||
" GROUP BY account.id" +
|
" GROUP BY account.id" +
|
||||||
" ORDER BY CASE WHEN :all THEN 0 ELSE account.`order` END" +
|
" ORDER BY CASE WHEN :all THEN 0 ELSE account.`order` END" +
|
||||||
@@ -84,16 +84,16 @@ public interface DaoAccount {
|
|||||||
" (SELECT COUNT(account.id) FROM account" +
|
" (SELECT COUNT(account.id) FROM account" +
|
||||||
" WHERE synchronize" +
|
" WHERE synchronize" +
|
||||||
" AND state = 'connected') AS accounts" +
|
" AND state = 'connected') AS accounts" +
|
||||||
", (SELECT COUNT(operation.id) FROM operationprop AS operation" +
|
", (SELECT COUNT(operation.id) FROM operation" +
|
||||||
" JOIN folderprop AS folder ON folder.id = operation.folder" +
|
" JOIN folder ON folder.id = operation.folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" + // not outbox
|
" JOIN account ON account.id = folder.account" + // not outbox
|
||||||
" WHERE account.synchronize) AS operations")
|
" WHERE account.synchronize) AS operations")
|
||||||
LiveData<TupleAccountStats> liveStats();
|
LiveData<TupleAccountStats> liveStats();
|
||||||
|
|
||||||
@Query("SELECT account.id, l.id AS swipe_left, l.type AS left_type, r.id AS swipe_right, r.type AS right_type" +
|
@Query("SELECT account.id, l.id AS swipe_left, l.type AS left_type, r.id AS swipe_right, r.type AS right_type" +
|
||||||
" FROM accountprop AS account" +
|
" FROM account" +
|
||||||
" LEFT JOIN folderprop AS l ON l.id = account.swipe_left" +
|
" LEFT JOIN folder l ON l.id = account.swipe_left" +
|
||||||
" LEFT JOIN folderprop r ON r.id = account.swipe_right")
|
" LEFT JOIN folder r ON r.id = account.swipe_right")
|
||||||
LiveData<List<TupleAccountSwipes>> liveAccountSwipes();
|
LiveData<List<TupleAccountSwipes>> liveAccountSwipes();
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public interface DaoContact {
|
|||||||
|
|
||||||
@Query("SELECT contact.*, account.name AS accountName" +
|
@Query("SELECT contact.*, account.name AS accountName" +
|
||||||
" FROM contact" +
|
" FROM contact" +
|
||||||
" JOIN accountprop AS account ON account.id = contact.account" +
|
" JOIN account ON account.id = contact.account" +
|
||||||
" ORDER BY times_contacted DESC, last_contacted DESC")
|
" ORDER BY times_contacted DESC, last_contacted DESC")
|
||||||
LiveData<List<TupleContactEx>> liveContacts();
|
LiveData<List<TupleContactEx>> liveContacts();
|
||||||
|
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ public interface DaoFolder {
|
|||||||
List<TupleFolderEx> getFoldersEx(long account);
|
List<TupleFolderEx> getFoldersEx(long account);
|
||||||
|
|
||||||
@Query("SELECT folder.* FROM folder" +
|
@Query("SELECT folder.* FROM folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE account.synchronize" +
|
" WHERE account.synchronize" +
|
||||||
" AND folder.synchronize AND unified")
|
" AND folder.synchronize AND unified")
|
||||||
List<EntityFolder> getFoldersSynchronizingUnified();
|
List<EntityFolder> getFoldersSynchronizingUnified();
|
||||||
|
|
||||||
@Query("SELECT folder.* FROM folder" +
|
@Query("SELECT folder.* FROM folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE folder.id = :folder" +
|
" WHERE folder.id = :folder" +
|
||||||
" AND (:search OR (account.synchronize AND account.browse))")
|
" AND (:search OR (account.synchronize AND account.browse))")
|
||||||
EntityFolder getBrowsableFolder(long folder, boolean search);
|
EntityFolder getBrowsableFolder(long folder, boolean search);
|
||||||
@@ -59,7 +59,7 @@ public interface DaoFolder {
|
|||||||
@Query("SELECT folder.*" +
|
@Query("SELECT folder.*" +
|
||||||
", account.`order` AS accountOrder, account.name AS accountName" +
|
", account.`order` AS accountOrder, account.name AS accountName" +
|
||||||
" FROM folder" +
|
" FROM folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE account.`synchronize`")
|
" WHERE account.`synchronize`")
|
||||||
List<TupleFolderSort> getSortedFolders();
|
List<TupleFolderSort> getSortedFolders();
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ public interface DaoFolder {
|
|||||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id) AS operations" +
|
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id) AS operations" +
|
||||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id AND operation.state = 'executing') AS executing" +
|
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id AND operation.state = 'executing') AS executing" +
|
||||||
" FROM folder" +
|
" FROM folder" +
|
||||||
" LEFT JOIN accountprop AS account ON account.id = folder.account" +
|
" LEFT JOIN account ON account.id = folder.account" +
|
||||||
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
|
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
|
||||||
" WHERE account.id IS NULL" +
|
" WHERE account.id IS NULL" +
|
||||||
" OR (account.`synchronize` AND folder.navigation)" +
|
" OR (account.`synchronize` AND folder.navigation)" +
|
||||||
@@ -107,7 +107,7 @@ public interface DaoFolder {
|
|||||||
LiveData<List<TupleFolderNav>> liveNavigation();
|
LiveData<List<TupleFolderNav>> liveNavigation();
|
||||||
|
|
||||||
@Query("SELECT folder.* FROM folder" +
|
@Query("SELECT folder.* FROM folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE account.synchronize" +
|
" WHERE account.synchronize" +
|
||||||
" AND account.`primary`" +
|
" AND account.`primary`" +
|
||||||
" AND folder.type = '" + EntityFolder.DRAFTS + "'")
|
" AND folder.type = '" + EntityFolder.DRAFTS + "'")
|
||||||
@@ -149,19 +149,19 @@ public interface DaoFolder {
|
|||||||
EntityFolder getFolderByType(long account, String type);
|
EntityFolder getFolderByType(long account, String type);
|
||||||
|
|
||||||
@Query("SELECT folder.* FROM folder" +
|
@Query("SELECT folder.* FROM folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE `primary` AND type = '" + EntityFolder.DRAFTS + "'")
|
" WHERE `primary` AND type = '" + EntityFolder.DRAFTS + "'")
|
||||||
EntityFolder getPrimaryDrafts();
|
EntityFolder getPrimaryDrafts();
|
||||||
|
|
||||||
@Query("SELECT folder.* FROM folder" +
|
@Query("SELECT folder.* FROM folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE `primary` AND type = '" + EntityFolder.ARCHIVE + "'")
|
" WHERE `primary` AND type = '" + EntityFolder.ARCHIVE + "'")
|
||||||
EntityFolder getPrimaryArchive();
|
EntityFolder getPrimaryArchive();
|
||||||
|
|
||||||
@Query("SELECT * FROM folder WHERE type = '" + EntityFolder.OUTBOX + "'")
|
@Query("SELECT * FROM folder WHERE type = '" + EntityFolder.OUTBOX + "'")
|
||||||
EntityFolder getOutbox();
|
EntityFolder getOutbox();
|
||||||
|
|
||||||
@Query("SELECT download FROM folderprop WHERE id = :id")
|
@Query("SELECT download FROM folder WHERE id = :id")
|
||||||
boolean getFolderDownload(long id);
|
boolean getFolderDownload(long id);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ import java.util.List;
|
|||||||
@Dao
|
@Dao
|
||||||
public interface DaoIdentity {
|
public interface DaoIdentity {
|
||||||
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
|
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
|
||||||
" JOIN accountprop AS account ON account.id = identity.account" +
|
" JOIN account ON account.id = identity.account" +
|
||||||
" WHERE NOT :synchronize OR account.synchronize")
|
" WHERE NOT :synchronize OR account.synchronize")
|
||||||
LiveData<List<TupleIdentityEx>> liveIdentities(boolean synchronize);
|
LiveData<List<TupleIdentityEx>> liveIdentities(boolean synchronize);
|
||||||
|
|
||||||
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
|
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
|
||||||
" JOIN accountprop AS account ON account.id = identity.account" +
|
" JOIN account ON account.id = identity.account" +
|
||||||
" JOIN folderprop AS folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
|
" JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
|
||||||
" WHERE (:account IS NULL OR identity.account = :account)" +
|
" WHERE (:account IS NULL OR identity.account = :account)" +
|
||||||
" AND identity.synchronize" +
|
" AND identity.synchronize" +
|
||||||
" AND account.synchronize" +
|
" AND account.synchronize" +
|
||||||
@@ -45,8 +45,8 @@ public interface DaoIdentity {
|
|||||||
List<TupleIdentityEx> getComposableIdentities(Long account);
|
List<TupleIdentityEx> getComposableIdentities(Long account);
|
||||||
|
|
||||||
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
|
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
|
||||||
" JOIN accountprop AS account ON account.id = identity.account" +
|
" JOIN account ON account.id = identity.account" +
|
||||||
" JOIN folderprop AS folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
|
" JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
|
||||||
" WHERE (:account IS NULL OR identity.account = :account)" +
|
" WHERE (:account IS NULL OR identity.account = :account)" +
|
||||||
" AND identity.synchronize" +
|
" AND identity.synchronize" +
|
||||||
" AND account.synchronize")
|
" AND account.synchronize")
|
||||||
|
|||||||
@@ -48,15 +48,15 @@ public interface DaoMessage {
|
|||||||
", COUNT(message.id) AS count" +
|
", COUNT(message.id) AS count" +
|
||||||
", " + unseen_unified + " AS unseen" +
|
", " + unseen_unified + " AS unseen" +
|
||||||
", " + unflagged_unified + " AS unflagged" +
|
", " + unflagged_unified + " AS unflagged" +
|
||||||
", (SELECT COUNT(a.id) FROM attachmentprop a WHERE a.message = message.id) AS attachments" +
|
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||||
", SUM(CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END) AS drafts" +
|
", SUM(CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END) AS drafts" +
|
||||||
", COUNT(DISTINCT CASE WHEN message.msgid IS NULL THEN message.id ELSE message.msgid END) AS visible" +
|
", COUNT(DISTINCT CASE WHEN message.msgid IS NULL THEN message.id ELSE message.msgid END) AS visible" +
|
||||||
", SUM(message.size) AS totalSize" +
|
", SUM(message.size) AS totalSize" +
|
||||||
", MAX(CASE WHEN :found OR folder.unified THEN message.received ELSE 0 END) AS dummy" +
|
", MAX(CASE WHEN :found OR folder.unified THEN message.received ELSE 0 END) AS dummy" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" WHERE account.`synchronize`" +
|
" WHERE account.`synchronize`" +
|
||||||
" AND (NOT message.ui_hide OR :debug)" +
|
" AND (NOT message.ui_hide OR :debug)" +
|
||||||
" AND (NOT :found OR ui_found = :found)" +
|
" AND (NOT :found OR ui_found = :found)" +
|
||||||
@@ -94,16 +94,16 @@ public interface DaoMessage {
|
|||||||
", COUNT(message.id) AS count" +
|
", COUNT(message.id) AS count" +
|
||||||
", " + unseen_folder + " AS unseen" +
|
", " + unseen_folder + " AS unseen" +
|
||||||
", " + unflagged_folder + " AS unflagged" +
|
", " + unflagged_folder + " AS unflagged" +
|
||||||
", (SELECT COUNT(a.id) FROM attachmentprop a WHERE a.message = message.id) AS attachments" +
|
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||||
", SUM(CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END) AS drafts" +
|
", SUM(CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END) AS drafts" +
|
||||||
", COUNT(DISTINCT CASE WHEN message.msgid IS NULL THEN message.id ELSE message.msgid END) AS visible" +
|
", COUNT(DISTINCT CASE WHEN message.msgid IS NULL THEN message.id ELSE message.msgid END) AS visible" +
|
||||||
", SUM(message.size) AS totalSize" +
|
", SUM(message.size) AS totalSize" +
|
||||||
", MAX(CASE WHEN folder.id = :folder THEN message.received ELSE 0 END) AS dummy" +
|
", MAX(CASE WHEN folder.id = :folder THEN message.received ELSE 0 END) AS dummy" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" JOIN folderprop AS f ON f.id = :folder" +
|
" JOIN folder AS f ON f.id = :folder" +
|
||||||
" WHERE (message.account = f.account OR " + is_outbox + ")" +
|
" WHERE (message.account = f.account OR " + is_outbox + ")" +
|
||||||
" AND (NOT message.ui_hide OR :debug)" +
|
" AND (NOT message.ui_hide OR :debug)" +
|
||||||
" AND (NOT :found OR ui_found = :found)" +
|
" AND (NOT :found OR ui_found = :found)" +
|
||||||
@@ -137,14 +137,14 @@ public interface DaoMessage {
|
|||||||
", 1 AS count" +
|
", 1 AS count" +
|
||||||
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
||||||
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
||||||
", (SELECT COUNT(a.id) FROM attachmentprop a WHERE a.message = message.id) AS attachments" +
|
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||||
", CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END AS drafts" +
|
", CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END AS drafts" +
|
||||||
", 1 AS visible" +
|
", 1 AS visible" +
|
||||||
", message.size AS totalSize" +
|
", message.size AS totalSize" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" WHERE message.account = :account" +
|
" WHERE message.account = :account" +
|
||||||
" AND message.thread = :thread" +
|
" AND message.thread = :thread" +
|
||||||
" AND (:id IS NULL OR message.id = :id)" +
|
" AND (:id IS NULL OR message.id = :id)" +
|
||||||
@@ -157,7 +157,7 @@ public interface DaoMessage {
|
|||||||
", COUNT(message.id) AS count" +
|
", COUNT(message.id) AS count" +
|
||||||
", SUM(message.ui_seen) AS seen" +
|
", SUM(message.ui_seen) AS seen" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" WHERE message.account = :account" +
|
" WHERE message.account = :account" +
|
||||||
" AND message.thread = :thread" +
|
" AND message.thread = :thread" +
|
||||||
" AND (:id IS NULL OR message.id = :id)" +
|
" AND (:id IS NULL OR message.id = :id)" +
|
||||||
@@ -165,7 +165,7 @@ public interface DaoMessage {
|
|||||||
" GROUP BY account.id")
|
" GROUP BY account.id")
|
||||||
LiveData<TupleThreadStats> liveThreadStats(long account, String thread, Long id);
|
LiveData<TupleThreadStats> liveThreadStats(long account, String thread, Long id);
|
||||||
|
|
||||||
@Query("SELECT message.id FROM folderprop AS folder" +
|
@Query("SELECT message.id FROM folder" +
|
||||||
" JOIN message ON message.folder = folder.id" +
|
" JOIN message ON message.folder = folder.id" +
|
||||||
" WHERE CASE WHEN :folder IS NULL THEN folder.unified ELSE folder.id = :folder END" +
|
" WHERE CASE WHEN :folder IS NULL THEN folder.unified ELSE folder.id = :folder END" +
|
||||||
" AND ui_hide")
|
" AND ui_hide")
|
||||||
@@ -208,7 +208,7 @@ public interface DaoMessage {
|
|||||||
List<Long> getMessageIdsByFolder(Long folder);
|
List<Long> getMessageIdsByFolder(Long folder);
|
||||||
|
|
||||||
@Query("SELECT message.id" +
|
@Query("SELECT message.id" +
|
||||||
" FROM folderprop AS folder" +
|
" FROM folder" +
|
||||||
" JOIN message ON message.folder = folder.id" +
|
" JOIN message ON message.folder = folder.id" +
|
||||||
" WHERE CASE WHEN :folder IS NULL THEN folder.unified ELSE folder.id = :folder END" +
|
" WHERE CASE WHEN :folder IS NULL THEN folder.unified ELSE folder.id = :folder END" +
|
||||||
" AND NOT ui_hide" +
|
" AND NOT ui_hide" +
|
||||||
@@ -243,14 +243,14 @@ public interface DaoMessage {
|
|||||||
", 1 AS count" +
|
", 1 AS count" +
|
||||||
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
||||||
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
||||||
", (SELECT COUNT(a.id) FROM attachmentprop a WHERE a.message = message.id) AS attachments" +
|
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||||
", CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END AS drafts" +
|
", CASE WHEN folder.type = '" + EntityFolder.DRAFTS + "' THEN 1 ELSE 0 END AS drafts" +
|
||||||
", 1 AS visible" +
|
", 1 AS visible" +
|
||||||
", message.size AS totalSize" +
|
", message.size AS totalSize" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" WHERE message.id = :id")
|
" WHERE message.id = :id")
|
||||||
LiveData<TupleMessageEx> liveMessage(long id);
|
LiveData<TupleMessageEx> liveMessage(long id);
|
||||||
|
|
||||||
@@ -266,9 +266,9 @@ public interface DaoMessage {
|
|||||||
", 1 AS visible" +
|
", 1 AS visible" +
|
||||||
", message.size AS totalSize" +
|
", message.size AS totalSize" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" WHERE account.`synchronize`" +
|
" WHERE account.`synchronize`" +
|
||||||
" AND folder.notify" +
|
" AND folder.notify" +
|
||||||
" AND (account.created IS NULL OR message.received > account.created)" +
|
" AND (account.created IS NULL OR message.received > account.created)" +
|
||||||
@@ -279,8 +279,8 @@ public interface DaoMessage {
|
|||||||
LiveData<List<TupleMessageEx>> liveUnseenNotify();
|
LiveData<List<TupleMessageEx>> liveUnseenNotify();
|
||||||
|
|
||||||
@Query("SELECT COUNT(message.id) FROM message" +
|
@Query("SELECT COUNT(message.id) FROM message" +
|
||||||
" JOIN accountprop AS account ON account.id = message.account" +
|
" JOIN account ON account.id = message.account" +
|
||||||
" JOIN folderprop AS folder ON folder.id = message.folder" +
|
" JOIN folder ON folder.id = message.folder" +
|
||||||
" WHERE account.`synchronize`" +
|
" WHERE account.`synchronize`" +
|
||||||
" AND folder.unified" +
|
" AND folder.unified" +
|
||||||
" AND (account.created IS NULL OR message.received > account.created)" +
|
" AND (account.created IS NULL OR message.received > account.created)" +
|
||||||
@@ -298,7 +298,7 @@ public interface DaoMessage {
|
|||||||
List<Long> getUids(long folder, Long received);
|
List<Long> getUids(long folder, Long received);
|
||||||
|
|
||||||
@Query("SELECT message.* FROM message" +
|
@Query("SELECT message.* FROM message" +
|
||||||
" JOIN folderprop AS folder on folder.id = message.folder" +
|
" JOIN folder on folder.id = message.folder" +
|
||||||
" WHERE message.account = :account" +
|
" WHERE message.account = :account" +
|
||||||
" AND folder.type = '" + EntityFolder.OUTBOX + "'" +
|
" AND folder.type = '" + EntityFolder.OUTBOX + "'" +
|
||||||
" AND sent IS NOT NULL")
|
" AND sent IS NOT NULL")
|
||||||
@@ -398,7 +398,7 @@ public interface DaoMessage {
|
|||||||
|
|
||||||
@Query("UPDATE message SET ui_ignored = 1" +
|
@Query("UPDATE message SET ui_ignored = 1" +
|
||||||
" WHERE NOT ui_ignored" +
|
" WHERE NOT ui_ignored" +
|
||||||
" AND folder IN (SELECT id FROM folderprop WHERE type = '" + EntityFolder.INBOX + "')")
|
" AND folder IN (SELECT id FROM folder WHERE type = '" + EntityFolder.INBOX + "')")
|
||||||
int ignoreAll();
|
int ignoreAll();
|
||||||
|
|
||||||
@Query("UPDATE message SET ui_found = 1" +
|
@Query("UPDATE message SET ui_found = 1" +
|
||||||
@@ -436,7 +436,7 @@ public interface DaoMessage {
|
|||||||
" WHERE folder = :folder" +
|
" WHERE folder = :folder" +
|
||||||
" AND uid IS NULL" +
|
" AND uid IS NULL" +
|
||||||
" AND NOT EXISTS" +
|
" AND NOT EXISTS" +
|
||||||
" (SELECT * FROM operationprop AS operation" +
|
" (SELECT * FROM operation" +
|
||||||
" WHERE operation.message = message.id" +
|
" WHERE operation.message = message.id" +
|
||||||
" AND operation.name = '" + EntityOperation.ADD + "')")
|
" AND operation.name = '" + EntityOperation.ADD + "')")
|
||||||
int deleteOrphans(long folder);
|
int deleteOrphans(long folder);
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ public interface DaoOperation {
|
|||||||
" ,((account.synchronize IS NULL OR account.synchronize)" +
|
" ,((account.synchronize IS NULL OR account.synchronize)" +
|
||||||
" AND (NOT folder.account IS NULL OR identity.synchronize IS NULL OR identity.synchronize)) AS synchronize" +
|
" AND (NOT folder.account IS NULL OR identity.synchronize IS NULL OR identity.synchronize)) AS synchronize" +
|
||||||
" FROM operation" +
|
" FROM operation" +
|
||||||
" JOIN folderprop AS folder ON folder.id = operation.folder" +
|
" JOIN folder ON folder.id = operation.folder" +
|
||||||
" LEFT JOIN message ON message.id = operation.message" +
|
" LEFT JOIN message ON message.id = operation.message" +
|
||||||
" LEFT JOIN accountprop AS account ON account.id = message.account OR account.id = folder.account" +
|
" LEFT JOIN account ON account.id = message.account OR account.id = folder.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" ORDER BY" +
|
" ORDER BY" +
|
||||||
" CASE WHEN operation.name = '" + EntityOperation.SYNC + "' THEN" +
|
" CASE WHEN operation.name = '" + EntityOperation.SYNC + "' THEN" +
|
||||||
@@ -45,9 +45,9 @@ public interface DaoOperation {
|
|||||||
LiveData<List<TupleOperationEx>> liveOperations();
|
LiveData<List<TupleOperationEx>> liveOperations();
|
||||||
|
|
||||||
String GET_OPS_FOLDER = "SELECT operation.* FROM operation" +
|
String GET_OPS_FOLDER = "SELECT operation.* FROM operation" +
|
||||||
" JOIN folderprop AS folder ON folder.id = operation.folder" +
|
" JOIN folder ON folder.id = operation.folder" +
|
||||||
" LEFT JOIN message ON message.id = operation.message" +
|
" LEFT JOIN message ON message.id = operation.message" +
|
||||||
" LEFT JOIN accountprop AS account ON account.id = message.account" +
|
" LEFT JOIN account ON account.id = message.account" +
|
||||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" WHERE operation.folder = :folder" +
|
" WHERE operation.folder = :folder" +
|
||||||
" AND (account.synchronize IS NULL OR account.synchronize)" +
|
" AND (account.synchronize IS NULL OR account.synchronize)" +
|
||||||
@@ -70,7 +70,7 @@ public interface DaoOperation {
|
|||||||
" FROM operation")
|
" FROM operation")
|
||||||
LiveData<TupleOperationStats> liveStats();
|
LiveData<TupleOperationStats> liveStats();
|
||||||
|
|
||||||
@Query("SELECT COUNT(operation.id) FROM operationprop AS operation" +
|
@Query("SELECT COUNT(operation.id) FROM operation" +
|
||||||
" WHERE operation.name = '" + EntityOperation.SEND + "'")
|
" WHERE operation.name = '" + EntityOperation.SEND + "'")
|
||||||
LiveData<Integer> liveUnsent();
|
LiveData<Integer> liveUnsent();
|
||||||
|
|
||||||
@@ -83,12 +83,12 @@ public interface DaoOperation {
|
|||||||
@Query("SELECT * FROM operation WHERE error IS NOT NULL")
|
@Query("SELECT * FROM operation WHERE error IS NOT NULL")
|
||||||
List<EntityOperation> getOperationsError();
|
List<EntityOperation> getOperationsError();
|
||||||
|
|
||||||
@Query("SELECT COUNT(id) FROM operationprop AS operation" +
|
@Query("SELECT COUNT(id) FROM operation" +
|
||||||
" WHERE folder = :folder" +
|
" WHERE folder = :folder" +
|
||||||
" AND (:name IS NULL OR operation.name = :name)")
|
" AND (:name IS NULL OR operation.name = :name)")
|
||||||
int getOperationCount(long folder, String name);
|
int getOperationCount(long folder, String name);
|
||||||
|
|
||||||
@Query("SELECT COUNT(id) FROM operationprop" +
|
@Query("SELECT COUNT(id) FROM operation" +
|
||||||
" WHERE folder = :folder" +
|
" WHERE folder = :folder" +
|
||||||
" AND message = :message")
|
" AND message = :message")
|
||||||
int getOperationCount(long folder, long message);
|
int getOperationCount(long folder, long message);
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ public interface DaoRule {
|
|||||||
List<EntityRule> getEnabledRules(long folder);
|
List<EntityRule> getEnabledRules(long folder);
|
||||||
|
|
||||||
@Query("SELECT rule.*, folder.account, folder.name AS folderName, account.name AS accountName FROM rule" +
|
@Query("SELECT rule.*, folder.account, folder.name AS folderName, account.name AS accountName FROM rule" +
|
||||||
" JOIN folderprop AS folder ON folder.id = rule.folder" +
|
" JOIN folder ON folder.id = rule.folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE rule.id = :id")
|
" WHERE rule.id = :id")
|
||||||
TupleRuleEx getRule(long id);
|
TupleRuleEx getRule(long id);
|
||||||
|
|
||||||
@Query("SELECT rule.*, folder.account, folder.name AS folderName, account.name AS accountName FROM rule" +
|
@Query("SELECT rule.*, folder.account, folder.name AS folderName, account.name AS accountName FROM rule" +
|
||||||
" JOIN folderprop AS folder ON folder.id = rule.folder" +
|
" JOIN folder ON folder.id = rule.folder" +
|
||||||
" JOIN accountprop AS account ON account.id = folder.account" +
|
" JOIN account ON account.id = folder.account" +
|
||||||
" WHERE rule.folder = :folder" +
|
" WHERE rule.folder = :folder" +
|
||||||
" ORDER BY `order`, name COLLATE NOCASE")
|
" ORDER BY `order`, name COLLATE NOCASE")
|
||||||
LiveData<List<TupleRuleEx>> liveRules(long folder);
|
LiveData<List<TupleRuleEx>> liveRules(long folder);
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
package eu.faircode.email;
|
|
||||||
|
|
||||||
/*
|
|
||||||
This file is part of FairEmail.
|
|
||||||
|
|
||||||
FairEmail is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
FairEmail is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.room.DatabaseView;
|
|
||||||
|
|
||||||
@DatabaseView(
|
|
||||||
viewName = "accountprop",
|
|
||||||
value = "SELECT id, name, color, synchronize, `primary`, notify, browse, swipe_left, swipe_right, created, `order` FROM account")
|
|
||||||
public class EntityAccountProp {
|
|
||||||
public Long id;
|
|
||||||
public String name;
|
|
||||||
public Integer color;
|
|
||||||
@NonNull
|
|
||||||
public Boolean synchronize;
|
|
||||||
@NonNull
|
|
||||||
public Boolean primary;
|
|
||||||
@NonNull
|
|
||||||
public Boolean notify;
|
|
||||||
@NonNull
|
|
||||||
public Boolean browse = true;
|
|
||||||
public Long swipe_left;
|
|
||||||
public Long swipe_right;
|
|
||||||
public Long created;
|
|
||||||
public Integer order;
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package eu.faircode.email;
|
|
||||||
|
|
||||||
/*
|
|
||||||
This file is part of FairEmail.
|
|
||||||
|
|
||||||
FairEmail is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
FairEmail is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.room.DatabaseView;
|
|
||||||
|
|
||||||
@DatabaseView(
|
|
||||||
viewName = "attachmentprop",
|
|
||||||
value = "SELECT id, message, name FROM attachment")
|
|
||||||
public class EntityAttachmentProp {
|
|
||||||
public Long id;
|
|
||||||
@NonNull
|
|
||||||
public Long message;
|
|
||||||
public String name;
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package eu.faircode.email;
|
|
||||||
|
|
||||||
/*
|
|
||||||
This file is part of FairEmail.
|
|
||||||
|
|
||||||
FairEmail is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
FairEmail is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.room.DatabaseView;
|
|
||||||
|
|
||||||
@DatabaseView(
|
|
||||||
viewName = "folderprop",
|
|
||||||
value = "SELECT id, account, name, type, download, display, unified, notify FROM folder")
|
|
||||||
public class EntityFolderProp {
|
|
||||||
public Long id;
|
|
||||||
public Long account;
|
|
||||||
@NonNull
|
|
||||||
public String name;
|
|
||||||
@NonNull
|
|
||||||
public String type;
|
|
||||||
@NonNull
|
|
||||||
public Boolean download = true;
|
|
||||||
public String display;
|
|
||||||
@NonNull
|
|
||||||
public Boolean unified = false;
|
|
||||||
@NonNull
|
|
||||||
public Boolean notify = false;
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package eu.faircode.email;
|
|
||||||
|
|
||||||
/*
|
|
||||||
This file is part of FairEmail.
|
|
||||||
|
|
||||||
FairEmail is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
FairEmail is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.room.DatabaseView;
|
|
||||||
|
|
||||||
@DatabaseView(
|
|
||||||
viewName = "operationprop",
|
|
||||||
value = "SELECT id, folder, message, name FROM operation")
|
|
||||||
public class EntityOperationProp {
|
|
||||||
public Long id;
|
|
||||||
@NonNull
|
|
||||||
public Long folder;
|
|
||||||
public Long message;
|
|
||||||
@NonNull
|
|
||||||
public String name;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user