[evolution-ews] Implement delete addressbook. Propagate the error to the callers in some places where it was missed.
- From: Chenthill Palanisamy <pchen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Implement delete addressbook. Propagate the error to the callers in some places where it was missed.
- Date: Wed, 11 May 2011 16:54:25 +0000 (UTC)
commit 68542282656fa6e9514e866a2aa2cd78fd9321a4
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Wed May 11 22:20:23 2011 +0530
Implement delete addressbook.
Propagate the error to the callers in some places where it was missed.
src/addressbook/e-book-backend-sqlitedb.c | 48 ++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-sqlitedb.c b/src/addressbook/e-book-backend-sqlitedb.c
index 8f10a3b..742efa4 100644
--- a/src/addressbook/e-book-backend-sqlitedb.c
+++ b/src/addressbook/e-book-backend-sqlitedb.c
@@ -1140,6 +1140,7 @@ e_book_backend_sqlitedb_set_is_populated (EBookBackendSqliteDB *ebsdb,
if (err)
ret = FALSE;
+ g_propagate_error (error, err);
return ret;
}
@@ -1187,6 +1188,7 @@ e_book_backend_sqlitedb_set_has_partial_content (EBookBackendSqliteDB *ebsdb,
if (err)
ret = FALSE;
+ g_propagate_error (error, err);
return ret;
}
@@ -1243,6 +1245,7 @@ e_book_backend_sqlitedb_set_sync_data (EBookBackendSqliteDB *ebsdb,
if (err)
ret = FALSE;
+ g_propagate_error (error, err);
return ret;
}
@@ -1283,12 +1286,14 @@ e_book_backend_sqlitedb_set_key_value (EBookBackendSqliteDB *ebsdb,
stmt = sqlite3_mprintf ("INSERT or REPLACE INTO keys (key, value, folder_id) \
values (%Q %Q %Q)", key, value, folderid);
book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, &err);
+ sqlite3_free (stmt);
book_backend_sqlitedb_end_transaction (ebsdb, &err);
WRITER_UNLOCK (ebsdb);
if (err)
ret = FALSE;
-
+
+ g_propagate_error (error, err);
return ret;
}
@@ -1311,3 +1316,44 @@ e_book_backend_sqlitedb_get_partially_cached_ids (EBookBackendSqliteDB *ebsdb,
return uids;
}
+
+gboolean
+e_book_backend_sqlitedb_delete_addressbook (EBookBackendSqliteDB *ebsdb,
+ const gchar *folderid,
+ GError **error)
+{
+ gchar *stmt;
+ GError *err = NULL;
+ gboolean ret = TRUE;
+
+ WRITER_LOCK (ebsdb);
+ book_backend_sqlitedb_start_transaction (ebsdb, &err);
+
+ /* delete the contacts table */
+ stmt = sqlite3_mprintf ("DROP TABLE %Q ", folderid);
+ book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, &err);
+ sqlite3_free (stmt);
+
+ /* delete the key/value pairs corresponding to this table */
+ if (!err) {
+ stmt = sqlite3_mprintf ("DELETE FROM keys WHERE folder_id = %Q", folderid);
+ book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, &err);
+ sqlite3_free (stmt);
+ }
+
+ /* delete the folder from the folders table */
+ if (!err) {
+ stmt = sqlite3_mprintf ("DELETE FROM folders WHERE folder_id = %Q", folderid);
+ book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, &err);
+ sqlite3_free (stmt);
+ }
+
+ book_backend_sqlitedb_end_transaction (ebsdb, &err);
+ WRITER_UNLOCK (ebsdb);
+
+ if (err)
+ ret = FALSE;
+
+ g_propagate_error (error, err);
+ return ret;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]