## EBookBackendSqliteDB

EBookBackendSqliteDB

## Synopsis

    struct              EBookBackendSqliteDB;
                        EbSdbSearchData;
    EBookBackendSqliteDB * e_book_backend_sqlitedb_new      (const gchar *path,
                                                             const gchar *email_id,
                                                             const gchar *folderid,
                                                             const gchar *folder_name,
                                                             gboolean store_vcard,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_add_contact (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             EContact *contact,
                                                             gboolean partial_content,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_add_contacts
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GSList *contacts,
                                                             gboolean partial_content,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_remove_contact
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_remove_contacts
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GSList *uids,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_has_contact (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             gboolean *partial_content,
                                                             GError **error);
    EContact *          e_book_backend_sqlitedb_get_contact (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);
    gchar *             e_book_backend_sqlitedb_get_vcard_string
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);
    GSList *            e_book_backend_sqlitedb_search      (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *sexp,
                                                             GSList *fields_of_interest,
                                                             GError **error);
    GSList *            e_book_backend_sqlitedb_search_uids (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *sexp,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_get_is_populated
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_set_is_populated
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             gboolean populated,
                                                             GError **error);
    gchar *             e_book_backend_sqlitedb_get_sync_data
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_set_sync_data
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *sync_data,
                                                             GError **error);
    gchar *             e_book_backend_sqlitedb_get_key_value
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *key,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_set_key_value
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *key,
                                                             const gchar *value,
                                                             GError **error);
    gchar *             e_book_backend_sqlitedb_get_contact_bdata
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_set_contact_bdata
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             const gchar *value,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_get_has_partial_content
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_set_has_partial_content
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             gboolean partial_content,
                                                             GError **error);
    GSList *            e_book_backend_sqlitedb_get_partially_cached_ids
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_delete_addressbook
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);
    gboolean            e_book_backend_sqlitedb_remove      (EBookBackendSqliteDB *ebsdb,
                                                             GError **error);
    void                e_book_backend_sqlitedb_search_data_free
                                                            (EbSdbSearchData *s_data);

## Description

## Details

### struct EBookBackendSqliteDB

    struct EBookBackendSqliteDB {
    	GObject parent;
    	EBookBackendSqliteDBPrivate *priv;
    };

### EbSdbSearchData

    typedef struct {
    	gchar *vcard;
    	gchar *uid;
    	gchar *bdata;
    } EbSdbSearchData;

### e_book_backend_sqlitedb_new ()

    EBookBackendSqliteDB * e_book_backend_sqlitedb_new      (const gchar *path,
                                                             const gchar *email_id,
                                                             const gchar *folderid,
                                                             const gchar *folder_name,
                                                             gboolean store_vcard,
                                                             GError **error);

If the path for multiple addressbooks are same, the contacts from all addressbooks would be stored in same db in different tables.

`path` : | location where the db would be created
`folderid` : | folder id of the address-book
`folder_name` : | name of the address-book
`store_vcard` : | True if the vcard should be stored inside db, if FALSE only the summary fields would be stored inside db.

### e_book_backend_sqlitedb_add_contact ()

    gboolean            e_book_backend_sqlitedb_add_contact (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             EContact *contact,
                                                             gboolean partial_content,
                                                             GError **error);

This is a convenience wrapper for e_book_backend_sqlitedb_add_contacts, which is the preferred means to add multiple contacts when possible.

`folderid` : | folder id
`contact` : | EContact to be added
`partial_content` : | contact does not contain full information. Used when the backend cache's partial information for auto-completion.
Returns : | TRUE on success.

### e_book_backend_sqlitedb_add_contacts ()

    gboolean            e_book_backend_sqlitedb_add_contacts
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GSList *contacts,
                                                             gboolean partial_content,
                                                             GError **error);

`folderid` : | folder id
`contacts` : | list of EContacts
`partial_content` : | contact does not contain full information. Used when the backend cache's partial information for auto-completion.
Returns : | TRUE on success.

### e_book_backend_sqlitedb_remove_contact ()

    gboolean            e_book_backend_sqlitedb_remove_contact
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);

### e_book_backend_sqlitedb_remove_contacts ()

    gboolean            e_book_backend_sqlitedb_remove_contacts
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GSList *uids,
                                                             GError **error);

### e_book_backend_sqlitedb_has_contact ()

    gboolean            e_book_backend_sqlitedb_has_contact (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             gboolean *partial_content,
                                                             GError **error);

### e_book_backend_sqlitedb_get_contact ()

    EContact *          e_book_backend_sqlitedb_get_contact (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);

### e_book_backend_sqlitedb_get_vcard_string ()

    gchar *             e_book_backend_sqlitedb_get_vcard_string
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);

### e_book_backend_sqlitedb_search ()

    GSList *            e_book_backend_sqlitedb_search      (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *sexp,
                                                             GSList *fields_of_interest,
                                                             GError **error);

Summary fields - uid, nickname, given_name, family_name, file_as email_1, email_2, email_3, email_4, is_list, list_show_addresses, wants_html

`sexp` : | search expression. &fields_of_interest: a GList containing the names of fields to return, or NULL for all. At the moment if this is non-null, the vcard will be populated with summary fields, else it would return the whole vcard if its stored in the db. [not implemented fully]
`error` : | Search on summary fields is always supported. Search expression containing any other field is supported only if backend chooses to store the vcard inside the db.
Returns : | List of EbSdbSearchData.

### e_book_backend_sqlitedb_search_uids ()

    GSList *            e_book_backend_sqlitedb_search_uids (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *sexp,
                                                             GError **error);

### e_book_backend_sqlitedb_get_is_populated ()

    gboolean            e_book_backend_sqlitedb_get_is_populated
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);

### e_book_backend_sqlitedb_set_is_populated ()

    gboolean            e_book_backend_sqlitedb_set_is_populated
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             gboolean populated,
                                                             GError **error);

### e_book_backend_sqlitedb_get_sync_data ()

    gchar *             e_book_backend_sqlitedb_get_sync_data
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);

### e_book_backend_sqlitedb_set_sync_data ()

    gboolean            e_book_backend_sqlitedb_set_sync_data
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *sync_data,
                                                             GError **error);

### e_book_backend_sqlitedb_get_key_value ()

    gchar *             e_book_backend_sqlitedb_get_key_value
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *key,
                                                             GError **error);

### e_book_backend_sqlitedb_set_key_value ()

    gboolean            e_book_backend_sqlitedb_set_key_value
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *key,
                                                             const gchar *value,
                                                             GError **error);

### e_book_backend_sqlitedb_get_contact_bdata ()

    gchar *             e_book_backend_sqlitedb_get_contact_bdata
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             GError **error);

### e_book_backend_sqlitedb_set_contact_bdata ()

    gboolean            e_book_backend_sqlitedb_set_contact_bdata
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             const gchar *uid,
                                                             const gchar *value,
                                                             GError **error);

### e_book_backend_sqlitedb_get_has_partial_content ()

    gboolean            e_book_backend_sqlitedb_get_has_partial_content
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);

Returns : | TRUE if the vcards stored in the db were downloaded partially. It is to indicate the stored vcards does not contain the full data.

### e_book_backend_sqlitedb_set_has_partial_content ()

    gboolean            e_book_backend_sqlitedb_set_has_partial_content
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             gboolean partial_content,
                                                             GError **error);

### e_book_backend_sqlitedb_get_partially_cached_ids ()

    GSList *            e_book_backend_sqlitedb_get_partially_cached_ids
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);

### e_book_backend_sqlitedb_delete_addressbook ()

    gboolean            e_book_backend_sqlitedb_delete_addressbook
                                                            (EBookBackendSqliteDB *ebsdb,
                                                             const gchar *folderid,
                                                             GError **error);

### e_book_backend_sqlitedb_remove ()

    gboolean            e_book_backend_sqlitedb_remove      (EBookBackendSqliteDB *ebsdb,
                                                             GError **error);

### e_book_backend_sqlitedb_search_data_free ()

    void                e_book_backend_sqlitedb_search_data_free
                                                            (EbSdbSearchData *s_data);