evolution-data-server r8925 - branches/camel-db-summary/camel
- From: psankar svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8925 - branches/camel-db-summary/camel
- Date: Thu, 5 Jun 2008 06:31:25 +0000 (UTC)
Author: psankar
Date: Thu Jun 5 06:31:24 2008
New Revision: 8925
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8925&view=rev
Log:
camel-folder-summary-clear's db apis
Modified:
branches/camel-db-summary/camel/camel-db.c
branches/camel-db-summary/camel/camel-db.h
branches/camel-db-summary/camel/camel-folder-summary.c
Modified: branches/camel-db-summary/camel/camel-db.c
==============================================================================
--- branches/camel-db-summary/camel/camel-db.c (original)
+++ branches/camel-db-summary/camel/camel-db.c Thu Jun 5 06:31:24 2008
@@ -500,17 +500,55 @@
}
int
-camel_db_delete_uids (CamelDB *cdb, char *folder, GSList *uids, CamelException *ex)
+camel_db_delete_uids (CamelDB *cdb, char *folder, CamelException *ex, int nargs, ... )
+{
+ char *query;
+ int ret, i;
+ GString *str = g_string_new ("DELETE FROM %Q WHERE uid IN (");
+ va_list listptr;
+
+ for (i = 1; i < nargs; ++i) {
+ g_string_append (str, " %Q ,");
+ }
+
+ g_string_append (str, " %Q )" );
+
+ va_start (listptr, nargs);
+ query = sqlite3_vmprintf (str->str, listptr);
+ va_end (listptr);
+
+ //ret = camel_db_command (cdb, tab, ex);
+
+ g_print ("The delete_uids query is : [%s]\n", query);
+ sqlite3_free (query);
+
+ return ret;
+}
+
+int
+camel_db_clear_folder_summary (CamelDB *cdb, char *folder, CamelException *ex)
{
- char *tab = sqlite3_mprintf ("DELETE FROM %Q WHERE uid = %Q", folder, uid);
int ret;
- ret = camel_db_command (cdb, tab, ex);
- sqlite3_free (tab);
+ char *folders_del;
+ char *msginfo_del;
+
+ folders_del = sqlite3_mprintf ("DELETE FROM folders WHERE folder_name = %Q", folder);
+ msginfo_del = sqlite3_mprintf ("DELETE FROM %Q ", folder);
+
+ camel_db_begin_transaction (cdb, ex);
+ camel_db_add_to_transaction (cdb, msginfo_del, ex);
+ camel_db_add_to_transaction (cdb, folders_del, ex);
+ ret = camel_db_end_transaction (cdb, ex);
+
+ sqlite3_free (folders_del);
+ sqlite3_free (msginfo_del);
return ret;
}
+
+
void
camel_db_camel_mir_free (CamelMIRecord *record)
{
Modified: branches/camel-db-summary/camel/camel-db.h
==============================================================================
--- branches/camel-db-summary/camel/camel-db.h (original)
+++ branches/camel-db-summary/camel/camel-db.h Thu Jun 5 06:31:24 2008
@@ -100,10 +100,11 @@
int camel_db_add_to_transaction (CamelDB *cdb, const char *query, CamelException *ex);
int camel_db_end_transaction (CamelDB *cdb, CamelException *ex);
int camel_db_abort_transaction (CamelDB *cdb, CamelException *ex);
+int camel_db_clear_folder_summary (CamelDB *cdb, char *folder, CamelException *ex);
-gboolean camel_db_delete_folder (CamelDB *cdb, char *folder, CamelException *ex);
-gboolean camel_db_delete_uid (CamelDB *cdb, char *folder, char *uid, CamelException *ex);
-gboolean camel_db_delete_uids (CamelDB *cdb, char *folder, GSList *uids, CamelException *ex);
+int camel_db_delete_folder (CamelDB *cdb, char *folder, CamelException *ex);
+int camel_db_delete_uid (CamelDB *cdb, char *folder, char *uid, CamelException *ex);
+int camel_db_delete_uids (CamelDB *cdb, char *folder, CamelException *ex, int nargs, ... );
int camel_db_create_folders_table (CamelDB *cdb, CamelException *ex);
int camel_db_select (CamelDB *cdb, const char* stmt, CamelDBSelectCB callback, gpointer data, CamelException *ex);
Modified: branches/camel-db-summary/camel/camel-folder-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.c (original)
+++ branches/camel-db-summary/camel/camel-folder-summary.c Thu Jun 5 06:31:24 2008
@@ -1556,7 +1556,6 @@
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
}
-#error "Implement camel_folder_summary_db_clear"
/**
* camel_folder_summary_clear:
* @summary: a #CamelFolderSummary object
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]