Needed to rethink storage strategies as I researched this and realized that a true scarce database -- where the database is sparsely populated both in columns and rows -- is not feasible due to IMAP's UID rules. The strategy now means that the database rows are contiguous from the highest (newest) message to the oldest *requested by the user*. This is a better situation than having to download the UID for the entire folder.
41 lines
1.6 KiB
Vala
41 lines
1.6 KiB
Vala
/* Copyright 2011 Yorba Foundation
|
|
*
|
|
* This software is licensed under the GNU Lesser General Public License
|
|
* (version 2.1 or later). See the COPYING file in this distribution.
|
|
*/
|
|
|
|
public class Geary.Sqlite.MessageLocationRow : Geary.Sqlite.Row {
|
|
public int64 id { get; private set; }
|
|
public int64 message_id { get; private set; }
|
|
public int64 folder_id { get; private set; }
|
|
public int64 ordering { get; private set; }
|
|
/**
|
|
* Note that position is not stored in the database, but rather determined by its location
|
|
* determined by the sorted ordering. If the database call is unable to easily determine the
|
|
* position of the message in the folder, this will be set to -1.
|
|
*/
|
|
public int position { get; private set; }
|
|
|
|
public MessageLocationRow(MessageLocationTable table, int64 id, int64 message_id, int64 folder_id,
|
|
int64 ordering, int position) {
|
|
base (table);
|
|
|
|
this.id = id;
|
|
this.message_id = message_id;
|
|
this.folder_id = folder_id;
|
|
this.ordering = ordering;
|
|
this.position = position;
|
|
}
|
|
|
|
public MessageLocationRow.from_query_result(MessageLocationTable table, int position,
|
|
SQLHeavy.QueryResult result) throws Error {
|
|
base (table);
|
|
|
|
id = fetch_int64_for(result, MessageLocationTable.Column.ID);
|
|
message_id = fetch_int64_for(result, MessageLocationTable.Column.MESSAGE_ID);
|
|
folder_id = fetch_int64_for(result, MessageLocationTable.Column.FOLDER_ID);
|
|
ordering = fetch_int64_for(result, MessageLocationTable.Column.ORDERING);
|
|
this.position = position;
|
|
}
|
|
}
|
|
|