evolution-data-server r8897 - in branches/camel-db-summary/camel: . providers/local
- From: psankar svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8897 - in branches/camel-db-summary/camel: . providers/local
- Date: Mon, 2 Jun 2008 13:35:54 +0000 (UTC)
Author: psankar
Date: Mon Jun 2 13:35:54 2008
New Revision: 8897
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8897&view=rev
Log:
ROLLBACK support for Transactions
Moving all SQL statements to camel-db to make it compliant with the
design.
Compiler warnings
Fixed missed type-casts explicitly needed.
Modified:
branches/camel-db-summary/camel/camel-db.c
branches/camel-db-summary/camel/camel-folder-summary.c
branches/camel-db-summary/camel/providers/local/camel-local-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 Mon Jun 2 13:35:54 2008
@@ -116,7 +116,7 @@
int ret;
d(g_print ("\nABORT TRANSACTION \n"));
- ret = cdb_sql_exec (cdb->db, "ABORT ", ex);
+ ret = cdb_sql_exec (cdb->db, "ROLLBACK", ex);
g_mutex_unlock (cdb->lock);
return ret;
@@ -167,15 +167,14 @@
return ret;
}
-/* We enforce it to be count and not COUNT just to speed up */
static int
count_cb (void *data, int argc, char **argv, char **azColName)
{
int i;
for(i=0; i<argc; i++) {
- if (strstr(azColName[i], "count")) {
- *(int *)data = atoi(argv[i]);
+ if (strstr(azColName[i], "COUNT")) {
+ *(guint32 *)data = argv [i] ? strtoul (argv [i], NULL, 10) : 0;
}
}
@@ -190,7 +189,7 @@
ret = sqlite3_exec (cdb->db, query, count_cb, count, &errmsg);
if (ret != SQLITE_OK) {
- d(g_print ("Error in SQL SELECT statement: %s [%s]\n", query, errmsg));
+ g_print ("Error in SQL SELECT statement: %s [%s]\n", query, errmsg);
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _(errmsg));
sqlite3_free (errmsg);
}
@@ -203,7 +202,7 @@
int ret;
if (!cdb)
- return 0;
+ return -1;
char *query;
query = sqlite3_mprintf ("SELECT COUNT (junk) FROM %Q WHERE junk = 1", table_name);
@@ -220,9 +219,9 @@
int ret;
if (!cdb)
- return 0;
+ return -1;
- char *query ;
+ char *query;
query = sqlite3_mprintf ("SELECT COUNT (read) FROM %Q WHERE read = 0", table_name);
ret = camel_db_count_message_info (cdb, query, count, ex);
@@ -238,7 +237,7 @@
int ret;
if (!cdb)
- return 0;
+ return -1;
char *query ;
query = sqlite3_mprintf ("SELECT COUNT (deleted) FROM %Q WHERE deleted = 1", table_name);
@@ -253,12 +252,13 @@
int
camel_db_count_total_message_info (CamelDB *cdb, const char *table_name, guint32 *count, CamelException *ex)
{
+
int ret;
+ char *query;
if (!cdb)
- return 0;
-
- char *query ;
+ return -1;
+
query = sqlite3_mprintf ("SELECT COUNT (uid) FROM %Q", table_name);
ret = camel_db_count_message_info (cdb, query, count, 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 Mon Jun 2 13:35:54 2008
@@ -883,6 +883,7 @@
record = (((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->summary_header_to_db (s, ex));
if (!record) {
+ camel_db_abort_transaction (cdb, ex);
return -1;
}
@@ -1876,13 +1877,13 @@
record->nextuid = s->nextuid;
record->time = s->time;
- if (!camel_db_count_total_message_info (db, table_name, &(record->saved_count), ex))
+ if (camel_db_count_total_message_info (db, table_name, &(record->saved_count), ex))
return NULL;
- if (!camel_db_count_junk_message_info (db, table_name, &(record->junk_count), ex))
+ if (camel_db_count_junk_message_info (db, table_name, &(record->junk_count), ex))
return NULL;
- if (!camel_db_count_deleted_message_info (db, table_name, &(record->deleted_count), ex))
+ if (camel_db_count_deleted_message_info (db, table_name, &(record->deleted_count), ex))
return NULL;
- if (!camel_db_count_unread_message_info (db, table_name, &(record->unread_count), ex))
+ if (camel_db_count_unread_message_info (db, table_name, &(record->unread_count), ex))
return NULL;
return record;
Modified: branches/camel-db-summary/camel/providers/local/camel-local-summary.c
==============================================================================
--- branches/camel-db-summary/camel/providers/local/camel-local-summary.c (original)
+++ branches/camel-db-summary/camel/providers/local/camel-local-summary.c Mon Jun 2 13:35:54 2008
@@ -411,6 +411,7 @@
ret = camel_folder_summary_save_to_db ((CamelFolderSummary *)cls, ex);
if (ret == -1) {
g_warning ("Could not save summary for local providers");
+ return -1;
}
if (cls->index && camel_index_sync(cls->index) == -1)
@@ -637,7 +638,7 @@
fir = ((CamelFolderSummaryClass *)camel_local_summary_parent)->summary_header_to_db (s, ex);
if (fir)
- fir->bdata = g_strdup_printf ("%lu", CAMEL_LOCAL_SUMMARY_VERSION);
+ fir->bdata = g_strdup_printf ("%d", CAMEL_LOCAL_SUMMARY_VERSION);
return fir;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]