evolution-data-server r9480 - trunk/camel



Author: sragavan
Date: Fri Sep  5 03:11:03 2008
New Revision: 9480
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9480&view=rev

Log:
Make db debuggable with camel-debug


Modified:
   trunk/camel/camel-db.c

Modified: trunk/camel/camel-db.c
==============================================================================
--- trunk/camel/camel-db.c	(original)
+++ trunk/camel/camel-db.c	Fri Sep  5 03:11:03 2008
@@ -36,6 +36,8 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
+#include "camel-debug.h"
+
 #if CAMEL_DB_DEBUG
 /* Enable d(x) if you want */
 #define d(x)
@@ -43,16 +45,11 @@
 #define START(stmt) 	g_print ("\n===========\nDB SQL operation [%s] started\n", stmt); cdb->timer = g_timer_new ();
 #define END 	g_timer_stop (cdb->timer); g_print ("DB Operation ended. Time Taken : %f\n###########\n", g_timer_elapsed (cdb->timer, NULL));
 #else
-#define d(x) 
+#define d(x) if (camel_debug("sqlite")) x
 #define START(x)
 #define END
 #endif
 
-
-/* Having this as a global variable, without mutex protection is wrong. 
-This will cause unnecessary crashes and multiple people using the resource etc. 
-You are advised to use this timer at your own risk. */
-
 static GStaticRecMutex trans_lock = G_STATIC_REC_MUTEX_INIT;	
 
 static int 
@@ -181,7 +178,6 @@
 			return TRUE;
 		g_mutex_lock (cdb->lock);
 
-		d(g_print("Executing: %s\n", stmt));
 		START(stmt);
 		ret = cdb_sql_exec (cdb->db, stmt, ex);
 		END;
@@ -1080,7 +1076,6 @@
 char *
 camel_db_get_column_name (const char *raw_name)
 {
-	d(g_print ("\n\aRAW name is : [%s] \n\a", raw_name));
 	if (!g_ascii_strcasecmp (raw_name, "Subject"))
 		return g_strdup ("subject");
 	else if (!g_ascii_strcasecmp (raw_name, "from"))



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