[evolution-data-server/openismus-work-3-8: 73/112] EBookBackendSqliteDB: Cursor API enhancements.



commit 833d36f7e64d00a92aa1fb8a12b409de85f0c373
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Jul 26 14:40:21 2013 +0900

    EBookBackendSqliteDB: Cursor API enhancements.
    
    When using the RESET origin, guarantee that both current
    and previous cursor states are reset. Same goes for alphabetic
    indexes, ensure that both cursor states are set to the new
    alphabetic index pointer and not just one of them.

 .../libedata-book/e-book-backend-sqlitedb.c        |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index a044851..f28e513 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -5825,6 +5825,7 @@ e_book_backend_sqlitedb_cursor_move_by (EBookBackendSqliteDB *ebsdb,
        case EBSDB_CURSOR_ORIGIN_RESET:
                /* Clear the current state before executing the query */
                ebsdb_cursor_clear_state (cursor, STATE_CURRENT);
+               ebsdb_cursor_clear_state (cursor, STATE_PREVIOUS);
                break;
        }
 
@@ -5955,10 +5956,14 @@ e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (EBookBackendSqliteDB
                                     NULL, NULL, NULL);
        g_return_if_fail (index < n_labels);
 
+       ebsdb_cursor_clear_state (cursor, STATE_PREVIOUS);
        ebsdb_cursor_clear_state (cursor, STATE_CURRENT);
-       if (cursor->n_sort_fields > 0)
+       if (cursor->n_sort_fields > 0) {
+               cursor->state[STATE_PREVIOUS].values[0] =
+                       e_collator_generate_key_for_index (ebsdb->priv->collator, index);
                cursor->state[STATE_CURRENT].values[0] =
                        e_collator_generate_key_for_index (ebsdb->priv->collator, index);
+       }
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]