[evolution-data-server] e_book_backend_sqlitedb_has_contact() used nonexistent column



commit 5b15fbc54cde54ad5c3c80a217896ced405598c4
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 4 17:17:49 2013 +0200

    e_book_backend_sqlitedb_has_contact() used nonexistent column
    
    The function used partial_content column of a respective folder table,
    but this is not available anymore, and references to this column are
    also no-op these days, thus I made this use the 'uid' column instead.
    The failure broke contact removal in evolution-ews.

 .../libedata-book/e-book-backend-sqlitedb.c        |   29 ++++++++-----------
 1 files changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 8604e6e..64e2c0a 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -2344,21 +2344,15 @@ e_book_backend_sqlitedb_remove_contacts (EBookBackendSqliteDB *ebsdb,
        return success;
 }
 
-struct _contact_info {
-       gboolean exists;
-       gboolean partial_content;
-};
-
 static gint
 contact_found_cb (gpointer ref,
                   gint col,
                   gchar **cols,
                   gchar **name)
 {
-       struct _contact_info *cinfo = ref;
+       gboolean *exists = ref;
 
-       cinfo->exists = TRUE;
-       cinfo->partial_content = cols[0] ? strtoul (cols[0], NULL, 10) : 0;
+       *exists = TRUE;
 
        return 0;
 }
@@ -2368,6 +2362,8 @@ contact_found_cb (gpointer ref,
  *
  * FIXME: Document me.
  *
+ * Note: The @partial_content is unused here.
+ *
  * Since: 3.2
  **/
 gboolean
@@ -2377,7 +2373,7 @@ e_book_backend_sqlitedb_has_contact (EBookBackendSqliteDB *ebsdb,
                                      gboolean *partial_content,
                                      GError **error)
 {
-       struct _contact_info cinfo;
+       gboolean exists = FALSE;
        gboolean success;
        gchar *stmt;
 
@@ -2385,26 +2381,23 @@ e_book_backend_sqlitedb_has_contact (EBookBackendSqliteDB *ebsdb,
        g_return_val_if_fail (folderid != NULL, FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
 
-       cinfo.exists = FALSE;
-       cinfo.partial_content = FALSE;
-
        LOCK_MUTEX (&ebsdb->priv->lock);
 
        stmt = sqlite3_mprintf (
-               "SELECT partial_content FROM %Q WHERE uid = %Q",
+               "SELECT uid FROM %Q WHERE uid = %Q",
                folderid, uid);
        success = book_backend_sql_exec (
-               ebsdb->priv->db, stmt, contact_found_cb , &cinfo, error);
+               ebsdb->priv->db, stmt, contact_found_cb, &exists, error);
        sqlite3_free (stmt);
 
-       if (success)
-               *partial_content = cinfo.partial_content;
+       if (partial_content)
+               *partial_content = FALSE;
 
        UNLOCK_MUTEX (&ebsdb->priv->lock);
 
        /* FIXME Returning FALSE can mean either "contact not found" or
         *       "error occurred".  Add a boolean (out) "exists" parameter. */
-       return success && cinfo.exists;
+       return success && exists;
 }
 
 static gint
@@ -4585,6 +4578,8 @@ e_book_backend_sqlitedb_set_key_value (EBookBackendSqliteDB *ebsdb,
  *
  * FIXME: Document me.
  *
+ * Note: Obsolete, do not use, it always ends with an error
+ *
  * Since: 3.2
  **/
 GSList *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]