Adding new EBookSqlite
authorTristan Van Berkom <tristanvb@openismus.com>
Tue, 19 Nov 2013 12:56:38 +0000 (21:56 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Fri, 29 Nov 2013 13:08:02 +0000 (22:08 +0900)
commit852a39604fdda602874e28009c35cada886fe43c
treee68af1d98c174128abcd9ba26f483e02d2e8bfd1
parent5d1961540320a8d9e4833ea447a283be78d67234
Adding new EBookSqlite

This is a complete rewrite for the EBookBackendSqliteDB API,
some improvements here include:

  o Support for e_book_query_exists() and e_book_query_not()

  o ESexp parsing only happens once, least possible processing
    while generating a query

  o Query preflighting stage checks for the validity of a query,
    and also optimizes it, so that the generated statement will
    be as fast as possible

  o Implementation of queries are now much more straigh forward,
    we have a single array of constraint generator functions, one
    for each type of EBookQueryTest

  o General interactions with SQLite is improved, functions like
    ebsql_string_append_printf() and book_backend_sqlite_exec_printf()
    reduce the amount of redundant code

  o Inserts are done with prepared SQLite statements, which should
    buy us optimization on batch inserts

  o Phone number queries no longer require the E_BOOK_INDEX_PHONE
    to work, however they are quicker with the index

  o Auxiliary tables are now created for each multi attribute contact
    field in the summary separately, reducing the amount of rows
    needed to traverse for a match (also adding more flexibility to
    how we handle these multi-attribute fields)

  o Special care has been taken to ensure that we begin write transactions
    with BEGIN IMMEDIATE, allowing us to fail gracefully if and when
    SQLITE_BUSY is returned

  o Schema upgrades are more failsafe, Just add columns needed in the
    summary if they are not already declared, even though SQLite does
    not support "ADD COLUMN IF NOT EXISTS".

  o When searching contacts with a search expression that cannot
    be satisfied by the summary columns, use a fallback built into
    the SQLite instead of loading everything into memory

  o Allow usage of the cursor with fields that are not in the summary,
    both for cursor ordering and filtering.

  o While relocalizing the whole database, care is taken to perform
    the operation in batches, this way EBookBackendSqlite does not
    ever try to load the whole database in memory at once.

  o Region code for phone number parsing is now tied into the locale
    setting and will change as a result of locale changes.

  o While relocalizing and reformatting the e164 phone number attributes
    in vcards, we send notifications for vcards which changed as a
    result of relocalization via a EbSqlVCardCallback which can
    be passed to e_book_backend_sqlite_set_locale()

  o Error codes are refined to be more meaningful in general than the
    traditional E_BOOK_SQLITE_ERROR_OTHER
addressbook/libedata-book/Makefile.am
addressbook/libedata-book/e-book-sqlite.c [new file with mode: 0644]
addressbook/libedata-book/e-book-sqlite.h [new file with mode: 0644]
addressbook/libedata-book/libedata-book.h
po/POTFILES.in