Closes #7120 Store and update unseen count in database
This commit is contained in:
parent
34236be3d5
commit
dc26b19aac
3 changed files with 15 additions and 6 deletions
|
|
@ -9,3 +9,4 @@ install(FILES version-006.sql DESTINATION ${SQL_DEST})
|
|||
install(FILES version-007.sql DESTINATION ${SQL_DEST})
|
||||
install(FILES version-008.sql DESTINATION ${SQL_DEST})
|
||||
install(FILES version-009.sql DESTINATION ${SQL_DEST})
|
||||
install(FILES version-010.sql DESTINATION ${SQL_DEST})
|
||||
|
|
|
|||
5
sql/version-010.sql
Normal file
5
sql/version-010.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
--
|
||||
-- Add unread count column to the FolderTable
|
||||
--
|
||||
|
||||
ALTER TABLE FolderTable ADD COLUMN unread_count INTEGER DEFAULT 0;
|
||||
|
|
@ -107,7 +107,7 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
// create the folder object
|
||||
Db.Statement stmt = cx.prepare(
|
||||
"INSERT INTO FolderTable (name, parent_id, last_seen_total, last_seen_status_total, "
|
||||
+ "uid_validity, uid_next, attributes) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||
+ "uid_validity, uid_next, attributes, unread_count) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
stmt.bind_string(0, path.basename);
|
||||
stmt.bind_rowid(1, parent_id);
|
||||
stmt.bind_int(2, Numeric.int_floor(properties.select_examine_messages, 0));
|
||||
|
|
@ -117,6 +117,7 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
stmt.bind_int64(5, (properties.uid_next != null) ? properties.uid_next.value
|
||||
: Imap.UID.INVALID);
|
||||
stmt.bind_string(6, properties.attrs.serialize());
|
||||
stmt.bind_int(7, properties.email_unread);
|
||||
|
||||
stmt.exec(cancellable);
|
||||
|
||||
|
|
@ -146,15 +147,17 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
Db.Statement stmt;
|
||||
if (parent_id != Db.INVALID_ROWID) {
|
||||
stmt = cx.prepare(
|
||||
"UPDATE FolderTable SET attributes=? WHERE parent_id=? AND name=?");
|
||||
"UPDATE FolderTable SET attributes=?, unread_count=? WHERE parent_id=? AND name=?");
|
||||
stmt.bind_string(0, properties.attrs.serialize());
|
||||
stmt.bind_rowid(1, parent_id);
|
||||
stmt.bind_string(2, path.basename);
|
||||
stmt.bind_int(1, properties.email_unread);
|
||||
stmt.bind_rowid(2, parent_id);
|
||||
stmt.bind_string(3, path.basename);
|
||||
} else {
|
||||
stmt = cx.prepare(
|
||||
"UPDATE FolderTable SET attributes=? WHERE parent_id IS NULL AND name=?");
|
||||
"UPDATE FolderTable SET attributes=?, unread_count=? WHERE parent_id IS NULL AND name=?");
|
||||
stmt.bind_string(0, properties.attrs.serialize());
|
||||
stmt.bind_string(1, path.basename);
|
||||
stmt.bind_int(1, properties.email_unread);
|
||||
stmt.bind_string(2, path.basename);
|
||||
}
|
||||
|
||||
stmt.exec();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue