** Fix for bug #558883
authorSrinivasa Ragavan <sragavan@novell.com>
Fri, 7 Nov 2008 03:26:51 +0000 (03:26 +0000)
committerSrinivasa Ragavan <sragavan@src.gnome.org>
Fri, 7 Nov 2008 03:26:51 +0000 (03:26 +0000)
2008-11-07  Srinivasa Ragavan  <sragavan@novell.com>

** Fix for bug #558883

* camel-db.c: (camel_db_prepare_message_info_table): Index more
fields.

svn path=/trunk/; revision=9738

camel/ChangeLog
camel/camel-db.c
camel/providers/imap/ChangeLog
camel/providers/imap/camel-imap-folder.c

index 90b3870..cccc3c1 100644 (file)
@@ -1,3 +1,10 @@
+2008-11-07  Srinivasa Ragavan  <sragavan@novell.com>
+
+       ** Fix for bug #558883
+
+       * camel-db.c: (camel_db_prepare_message_info_table): Index more
+       fields.
+
 2008-11-06  Milan Crha  <mcrha@redhat.com>
 
        ** Fix for bug #555979
index 177b765..ed99991 100644 (file)
@@ -738,6 +738,27 @@ camel_db_prepare_message_info_table (CamelDB *cdb, const char *folder_name, Came
        ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
        g_free (safe_index);
        sqlite3_free (table_creation_query);
+
+       /* Index on deleted*/
+       safe_index = g_strdup_printf("DELINDEX-%s", folder_name);
+       table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (deleted)", safe_index, folder_name);
+       ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+       g_free (safe_index);
+       sqlite3_free (table_creation_query);
+
+       /* Index on Junk*/
+       safe_index = g_strdup_printf("JUNKINDEX-%s", folder_name);
+       table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (junk)", safe_index, folder_name);
+       ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+       g_free (safe_index);
+       sqlite3_free (table_creation_query);
+       
+       /* Index on unread*/
+       safe_index = g_strdup_printf("READINDEX-%s", folder_name);
+       table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (read)", safe_index, folder_name);
+       ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
+       g_free (safe_index);
+       sqlite3_free (table_creation_query);
        
        return ret;
 }
index e930304..d900fe0 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-07  Srinivasa Ragavan  <sragavan@novell.com>
+
+       ** Fix for bug #558883
+
+       * camel-imap-folder.c: (imap_expunge): Do in bulk
+
 2008-11-06  Milan Crha  <mcrha@redhat.com>
 
        ** Fix for bug #558737
index 28c8644..2984058 100644 (file)
@@ -1584,25 +1584,16 @@ imap_expunge (CamelFolder *folder, CamelException *ex)
 {
        CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
        GPtrArray *uids;
-       int i, count;
-       CamelMessageInfo *info;
 
-       uids = g_ptr_array_new ();
-       count = camel_folder_summary_count (folder->summary);
-       for (i = 0; i < count; i++) {
-               info = camel_folder_summary_index (folder->summary, i);
-               if (camel_message_info_flags(info) & CAMEL_MESSAGE_DELETED)
-                       g_ptr_array_add (uids, g_strdup (camel_message_info_uid (info)));
-               camel_message_info_free(info);
-       }
+       camel_folder_summary_save_to_db (folder->summary, ex);
+       uids = camel_db_get_folder_deleted_uids (folder->parent_store->cdb_r, folder->full_name, ex);
 
        if (CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)
                imap_expunge_uids_online (folder, uids, ex);
        else
                imap_expunge_uids_offline (folder, uids, ex);
 
-       for (i = 0; i < uids->len; i++)
-               g_free (uids->pdata[i]);
+       g_ptr_array_foreach (uids, (GFunc) camel_pstring_free, NULL);
        g_ptr_array_free (uids, TRUE);
 }