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



commit 518c3fc95fb45ea9ed63ca8fb3528c74165ddc3b
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 1e473dd..15f15c9 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]