[evolution-ews] EBookBackendSqliteDB: Add e_book_backend_sqlitedb_create_addressbook.
- From: Chenthill Palanisamy <pchen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] EBookBackendSqliteDB: Add e_book_backend_sqlitedb_create_addressbook.
- Date: Sun, 10 Jul 2011 14:27:13 +0000 (UTC)
commit e298056221f82506d92eb9a0814bfb8d9f4373a1
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Sat Jul 9 11:14:49 2011 +0530
EBookBackendSqliteDB: Add e_book_backend_sqlitedb_create_addressbook.
src/addressbook/e-book-backend-sqlitedb.c | 37 +++++++++++++++++++++++++++-
src/addressbook/e-book-backend-sqlitedb.h | 6 ++++
2 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-sqlitedb.c b/src/addressbook/e-book-backend-sqlitedb.c
index 3fa2e46..4a6414f 100644
--- a/src/addressbook/e-book-backend-sqlitedb.c
+++ b/src/addressbook/e-book-backend-sqlitedb.c
@@ -453,13 +453,13 @@ book_backend_sqlitedb_load (EBookBackendSqliteDB *ebsdb,
* e_book_backend_sqlitedb_new
* @path: location where the db would be created
* @emailid: email id of the user
- * @folderid: folder id of the address-book
+ * @folderid: folder id of the address-book. This is used as primary_key for the folder.
* @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.
* @error:
*
* If the path for multiple addressbooks are same, the contacts from all addressbooks
- * would be stored in same db in different tables.
+ * would be stored in same db in different tables. It would also create a new address-book table with folder_id as its name.
*
* Returns:
**/
@@ -1647,6 +1647,39 @@ e_book_backend_sqlitedb_delete_addressbook (EBookBackendSqliteDB *ebsdb,
return !err;
}
+/**
+ * e_book_backend_sqlitedb_create_addressbook
+ * @ebsdb:
+ * @folder_id: Used as a primary key.
+ * @folder_name: Set the folder name prop.
+ * @store_vcard:
+ * @error:
+ *
+ * Creates an address-book table with folder_id as its name.
+ * Returns:
+ **/
+gboolean
+e_book_backend_sqlitedb_create_addressbook (EBookBackendSqliteDB *ebsdb,
+ const gchar *folderid,
+ const gchar *folder_name,
+ gboolean store_vcard,
+ GError **error)
+{
+ GError *err = NULL;
+ gboolean ret = TRUE;
+
+ add_folder_into_db (ebsdb, folderid, folder_name, &err);
+ if (!err)
+ create_contacts_table (ebsdb, folderid, &err);
+
+ if (err) {
+ g_propagate_error (error, err);
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
void
e_book_backend_sqlitedb_search_data_free (EbSdbSearchData *s_data)
{
diff --git a/src/addressbook/e-book-backend-sqlitedb.h b/src/addressbook/e-book-backend-sqlitedb.h
index 49099b7..eae6c05 100644
--- a/src/addressbook/e-book-backend-sqlitedb.h
+++ b/src/addressbook/e-book-backend-sqlitedb.h
@@ -180,6 +180,12 @@ gboolean e_book_backend_sqlitedb_delete_addressbook
(EBookBackendSqliteDB *ebsdb,
const gchar *folderid,
GError **error);
+gboolean e_book_backend_sqlitedb_create_addressbook
+ (EBookBackendSqliteDB *ebsdb,
+ const gchar *folder_id,
+ const gchar *folder_name,
+ gboolean store_vcard,
+ GError **error);
gboolean e_book_backend_sqlitedb_remove (EBookBackendSqliteDB *ebsdb,
GError **error);
void e_book_backend_sqlitedb_search_data_free
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]