[tracker/rss-enclosures] libtracker-db: Support disabling FTS



commit 9e39963d377016ad287acee81387af96ed69744b
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Jun 15 12:48:22 2010 +0200

    libtracker-db: Support disabling FTS

 src/libtracker-db/tracker-db-interface-sqlite.c |   12 +++++++++++-
 src/libtracker-db/tracker-db-manager.c          |   11 +++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index b1a4033..b871c1e 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -26,7 +26,10 @@
 #include <math.h>
 
 #include <libtracker-common/tracker-common.h>
+
+#if HAVE_TRACKER_FTS
 #include <libtracker-fts/tracker-fts.h>
+#endif
 
 #include "tracker-db-interface-sqlite.h"
 
@@ -41,7 +44,9 @@ struct TrackerDBInterface {
 	GSList *function_data;
 
 	guint ro : 1;
+#if HAVE_TRACKER_FTS
 	guint fts_initialized : 1;
+#endif
 	volatile gint interrupt;
 };
 
@@ -575,9 +580,11 @@ close_database (TrackerDBInterface *db_interface)
 	g_slist_free (db_interface->function_data);
 	db_interface->function_data = NULL;
 
+#if HAVE_TRACKER_FTS
 	if (db_interface->fts_initialized) {
 		tracker_fts_shutdown (G_OBJECT (db_interface));
 	}
+#endif
 
 	rc = sqlite3_close (db_interface->db);
 	g_warn_if_fail (rc == SQLITE_OK);
@@ -587,8 +594,12 @@ void
 tracker_db_interface_sqlite_fts_init (TrackerDBInterface *db_interface,
                                       gboolean            create)
 {
+#if HAVE_TRACKER_FTS
 	tracker_fts_init (db_interface->db, create, G_OBJECT (db_interface));
 	db_interface->fts_initialized = TRUE;
+#else
+	g_message ("FTS support is disabled");
+#endif
 }
 
 static void
@@ -602,7 +613,6 @@ tracker_db_interface_sqlite_finalize (GObject *object)
 
 	g_message ("Closed sqlite3 database:'%s'", db_interface->filename);
 
-
 	g_free (db_interface->filename);
 
 	G_OBJECT_CLASS (tracker_db_interface_parent_class)->finalize (object);
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index 6bdb777..9c48bd0 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -36,7 +36,10 @@
 #include <libtracker-common/tracker-date-time.h>
 #include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-common/tracker-utils.h>
+
+#if HAVE_TRACKER_FTS
 #include <libtracker-fts/tracker-fts.h>
+#endif
 
 #include "tracker-db-journal.h"
 #include "tracker-db-manager.h"
@@ -994,10 +997,14 @@ tracker_db_manager_shutdown (void)
 	sys_tmp_dir = NULL;
 	g_free (sql_dir);
 
+#if HAVE_TRACKER_FTS
 	/* shutdown fts in all threads
-	   needs to be done before shutting down all db interfaces as
-	   shutdown does not happen in thread where interface was created */
+	 * needs to be done before shutting down all db interfaces as
+	 * shutdown does not happen in thread where interface was created
+	 */
 	tracker_fts_shutdown_all ();
+#endif
+
 	/* shutdown db interfaces in all threads */
 	g_static_private_free (&interface_data_key);
 



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