[evolution-data-server/openismus-work-master: 62/118] EBookBackendSqliteDB: Cursor API enhancements.



commit 6565b825aeb585f7f3a9103978c8719b10b7746e
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 56b1fe0..da1a109 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -5840,6 +5840,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;
        }
 
@@ -5970,10 +5971,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]