EBookBackendSqliteDB: Adding cursor related APIs
authorTristan Van Berkom <tristanvb@openismus.com>
Mon, 22 Apr 2013 11:42:14 +0000 (20:42 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Wed, 23 Oct 2013 18:39:38 +0000 (20:39 +0200)
commit8cb1fa16781bcddfc74a0361afd046e04418c7dc
tree677bbae211d61ec30d622998068a2dbe1a392b3c
parentde8b5407440d7d5dd10b088b7c724f36c3b2f979
EBookBackendSqliteDB: Adding cursor related APIs

Added the following APIs:

      o e_book_backend_sqlitedb_cursor_new()

        Creates a cursor for a given query expression and sort order

      o e_book_backend_sqlitedb_cursor_free()

        Frees a cursor and it's resources

      o e_book_backend_sqlitedb_cursor_move_by()

        Moves the cursor and fetches results

        Moving the cursor now has 3 possible "origins":

          o EBSDB_CURSOR_ORIGIN_CURRENT:
            Fetch results and move from the current
            cursor position

          o EBSDB_CURSOR_ORIGIN_PREVIOUS:
            Fetch results and move from the previous
            cursor position, practical for refreshing
            a result set after the addressbook changes

          o EBSDB_CURSOR_ORIGIN_RESET:
            Fetch results from the beginning (or end,
            if moving backwards through results).

        To achieve the EBSDB_CURSOR_ORIGIN_PREVIOUS origin, the cursor
        holds on to two cursor states at all times (the current cursor
        state and previous cursor state).

      o e_book_backend_sqlitedb_cursor_set_target_alphabetic_index()

        To set the cursor target by alphabetic index, also added
        e_book_backend_sqlitedb_ref_collator() to get a hold of the active
        collator which can be used to list the active alphabet attributes.

      o e_book_backend_sqlite_cursor_calculate()

        Calculates the position / total values of a cursor.

      o e_book_backend_sqlitedb_cursor_set_sexp()

        Sets the search expression for a given cursor

      o e_book_backend_sqlitedb_get/set_locale()

        Locale setting is now only ever guessed when creating a new addressbook
        before e_book_backend_sqlitedb_set_locale() is called, setting the locale
        will save the localization setting and it will be reused on subsequent
        accesses. If and when a locale setting is changed, the contact sort
        keys are regenerated with a new ECollator for the new locale.

      o e_book_backend_sqlitedb_cursor_compare()

        An api to compare the cursor with an EContact, this allows
        EDataBookCursor to track total / position when the addressbook is
        modified without constantly recalculating it with SQLite queries.
addressbook/libebook-contacts/e-book-contacts-types.h
addressbook/libedata-book/e-book-backend-sqlitedb.c
addressbook/libedata-book/e-book-backend-sqlitedb.h