EBookBackendSqliteDB: Fix order by statement for cursor movement. upstream/openismus-work-3-8 upstream/3.9.90
authorTristan Van Berkom <tristanvb@openismus.com>
Tue, 18 Jun 2013 07:49:44 +0000 (16:49 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Tue, 18 Jun 2013 07:49:44 +0000 (16:49 +0900)
The order by statement must also order the contact UID, since the
UID is used as a tiebreaker between contacts which might be otherwise
identical, the search results must also be ordered by UID.

addressbook/libedata-book/e-book-backend-sqlitedb.c

index c2b73d8..8b84be7 100644 (file)
@@ -5287,6 +5287,11 @@ ebsdb_cursor_order_by_fragment (EBookBackendSqliteDB *ebsdb,
                                        (sort_types[i] == E_BOOK_SORT_ASCENDING ? "ASC"  : "DESC"));
        }
 
+       /* Also order the UID, since it's our tie breaker, we must also order the UID field */
+       if (n_sort_fields > 0)
+               g_string_append (string, ", ");
+       g_string_append_printf (string, "summary.uid %s", reverse ? "DESC" : "ASC");
+
        return g_string_free (string, FALSE);
 }