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



commit dfdd05b62cfdb4336f5ff0696745fc78e043146b
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 4c114a2..a03685e 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -128,17 +128,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,
@@ -328,17 +317,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;
@@ -368,9 +346,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,
@@ -944,13 +919,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);
@@ -1392,9 +1365,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]