[tracker/direct-access: 14/158] libtracker-data: Use single DB file



commit 2f9b940fb80dc13b9536b26ff3fbd34441d95ac1
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jul 20 10:39:54 2010 +0200

    libtracker-data: Use single DB file
    
    WAL does not guarantee atomicity with multiple DB files.

 src/libtracker-data/tracker-db-manager.c |   40 ++++-------------------------
 src/libtracker-fts/tracker-fts.c         |    6 ++--
 2 files changed, 9 insertions(+), 37 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 73c3d87..43769a2 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -129,17 +129,6 @@ static TrackerDBDefinition dbs[] = {
 	  FALSE,
 	  FALSE,
 	  0 },
-	{ TRACKER_DB_FULLTEXT,
-	  TRACKER_DB_LOCATION_DATA_DIR,
-	  NULL,
-	  "fulltext.db",
-	  "fulltext",
-	  NULL,
-	  512,
-	  TRACKER_DB_PAGE_SIZE_DONT_SET,
-	  FALSE,
-	  TRUE,
-	  0 },
 };
 
 static gboolean            db_exec_no_reply    (TrackerDBInterface *iface,
@@ -329,17 +318,6 @@ db_interface_get (TrackerDB  type,
 }
 
 static TrackerDBInterface *
-db_interface_get_fulltext (void)
-{
-	TrackerDBInterface *iface;
-	gboolean            create;
-
-	iface = db_interface_get (TRACKER_DB_FULLTEXT, &create);
-
-	return iface;
-}
-
-static TrackerDBInterface *
 db_interface_get_metadata (void)
 {
 	TrackerDBInterface *iface;
@@ -369,9 +347,6 @@ db_interface_create (TrackerDB db)
 	case TRACKER_DB_METADATA:
 		return db_interface_get_metadata ();
 
-	case TRACKER_DB_FULLTEXT:
-		return db_interface_get_fulltext ();
-
 	default:
 		g_critical ("This TrackerDB type:%d->'%s' has no interface set up yet!!",
 		            db,
@@ -945,13 +920,11 @@ tracker_db_manager_init (TrackerDBManagerFlags  flags,
 	thread_ifaces = g_hash_table_new (NULL, NULL);
 
 	if (flags & TRACKER_DB_MANAGER_READONLY) {
-		resources_iface = tracker_db_manager_get_db_interfaces_ro (2,
-		                                                           TRACKER_DB_METADATA,
-		                                                           TRACKER_DB_FULLTEXT);
+		resources_iface = tracker_db_manager_get_db_interfaces_ro (1,
+		                                                           TRACKER_DB_METADATA);
 	} else {
-		resources_iface = tracker_db_manager_get_db_interfaces (2,
-		                                                        TRACKER_DB_METADATA,
-		                                                        TRACKER_DB_FULLTEXT);
+		resources_iface = tracker_db_manager_get_db_interfaces (1,
+		                                                        TRACKER_DB_METADATA);
 	}
 
 	g_static_private_set (&interface_data_key, resources_iface, free_thread_interface);
@@ -1393,9 +1366,8 @@ tracker_db_manager_get_db_interface (void)
 
 	/* Ensure the interface is there */
 	if (!interface) {
-		interface = tracker_db_manager_get_db_interfaces (2,
-		                                                  TRACKER_DB_METADATA,
-		                                                  TRACKER_DB_FULLTEXT);
+		interface = tracker_db_manager_get_db_interfaces (1,
+		                                                  TRACKER_DB_METADATA);
 
 		tracker_db_interface_sqlite_fts_init (interface, FALSE);
 
diff --git a/src/libtracker-fts/tracker-fts.c b/src/libtracker-fts/tracker-fts.c
index b0fd382..f76b697 100644
--- a/src/libtracker-fts/tracker-fts.c
+++ b/src/libtracker-fts/tracker-fts.c
@@ -7908,10 +7908,10 @@ int tracker_fts_init(sqlite3 *db, int create, GObject *object){
   int rc = SQLITE_OK;
 
   if (create){
-    createTables (db, "fulltext", "fts");
+    createTables (db, "main", "fts");
   }
 
-  constructVtab(db, "fulltext", "fts", NULL, object);
+  constructVtab(db, "main", "fts", NULL, object);
 
   /* Create the virtual table wrapper around the hash-table and overload
   ** the two scalar functions. If this is successful, register the
@@ -7934,7 +7934,7 @@ int tracker_fts_init(sqlite3 *db, int create, GObject *object){
       return rc;
 
     if (create){
-        rc = sqlite3_exec(db, "CREATE VIRTUAL TABLE fulltext.fts USING trackerfts", NULL, 0, NULL);
+        rc = sqlite3_exec(db, "CREATE VIRTUAL TABLE fts USING trackerfts", NULL, 0, NULL);
     }
   }
 



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