tracker r2960 - in trunk: . data/db src/libtracker-data src/tracker-indexer



Author: mr
Date: Tue Feb 24 15:42:58 2009
New Revision: 2960
URL: http://svn.gnome.org/viewvc/tracker?rev=2960&view=rev

Log:
	* data/db/sqlite-stored-procs.sql:
	* data/db/sqlite-tracker.sql: 
	* src/libtracker-data/tracker-data-update.[ch]:
	* src/tracker-indexer/tracker-indexer.c:  Add $home as the first
	volume in the Volumes table with an id of 1 (has to be non-zero)
	and make sure all new items not related to a volume that are
	indexed use a default id of 1 instead of 0. Removed incstat and
	decstat stored procedures, they are not needed now. Updated the
	GetStats function call to get a real time count of the data, not a
	pre-calculated number from a table. Fixes NB#98297.


Modified:
   trunk/ChangeLog
   trunk/data/db/sqlite-stored-procs.sql
   trunk/data/db/sqlite-tracker.sql
   trunk/src/libtracker-data/tracker-data-update.c
   trunk/src/libtracker-data/tracker-data-update.h
   trunk/src/tracker-indexer/tracker-indexer.c

Modified: trunk/data/db/sqlite-stored-procs.sql
==============================================================================
--- trunk/data/db/sqlite-stored-procs.sql	(original)
+++ trunk/data/db/sqlite-stored-procs.sql	Tue Feb 24 15:42:58 2009
@@ -122,10 +122,7 @@
 /*
  * Statistics queries
  */
-IncStat                        UPDATE ServiceTypes SET TypeCount = (TypeCount + 1) WHERE TypeName = ?;
-DecStat                        UPDATE ServiceTypes SET TypeCount = (TypeCount - 1) WHERE TypeName = ?;
-GetStats                       SELECT TypeName, TypeCount FROM ServiceTypes GROUP BY TypeName ORDER BY TypeID ASC;
-
+GetStats                       SELECT COUNT(1), T.TypeName FROM Services S, ServiceTypes T WHERE S.AuxilaryID IN (SELECT VolumeID FROM Volumes WHERE Enabled = 1) AND S.Enabled = 1 AND T.TypeID=S.ServiceTypeID GROUP BY ServiceTypeID ORDER BY T.TypeName;
 GetHitDetails                  SELECT ROWID, HitCount, HitArraySize FROM HitIndex WHERE word = ?;
 
 /*
@@ -138,7 +135,7 @@
 InsertVolume                   INSERT INTO Volumes (MountPath, UDI, Enabled, DisabledDate) VALUES (?, ?, 1, date('now'));
 EnableVolume                   UPDATE Volumes SET MountPath = ?, Enabled = 1 WHERE UDI = ?;
 DisableVolume                  UPDATE Volumes SET Enabled = 0, DisabledDate = date ('now') WHERE UDI = ?;
-DisableAllVolumes              UPDATE Volumes SET Enabled = 0;
+DisableAllVolumes              UPDATE Volumes SET Enabled = 0 WHERE VolumeID > 1;
 
 /*
  * XESAM queries

Modified: trunk/data/db/sqlite-tracker.sql
==============================================================================
--- trunk/data/db/sqlite-tracker.sql	(original)
+++ trunk/data/db/sqlite-tracker.sql	Tue Feb 24 15:42:58 2009
@@ -15,7 +15,7 @@
 /* store volume and HAL info here for files */
 CREATE TABLE  Volumes
 (
-	VolumeID 	Integer primary key AUTOINCREMENT not null,
+	VolumeID 	Integer primary key AUTOINCREMENT,
 	UDI		Text,
 	VolumeName	Text,
 	MountPath	Text,
@@ -23,6 +23,7 @@
 	DisabledDate	Text
 );
 
+INSERT INTO Volumes (Enabled) VALUES ('1');
 
 /* provides links from one service entity to another (entities can be in different databases) */
 CREATE TABLE  ServiceLinks

Modified: trunk/src/libtracker-data/tracker-data-update.c
==============================================================================
--- trunk/src/libtracker-data/tracker-data-update.c	(original)
+++ trunk/src/libtracker-data/tracker-data-update.c	Tue Feb 24 15:42:58 2009
@@ -90,54 +90,6 @@
 }
 
 void
-tracker_data_update_increment_stats (TrackerDBInterface *iface,
-				     TrackerService     *service)
-{
-	const gchar *service_type, *parent;
-
-	service_type = tracker_service_get_name (service);
-	parent = tracker_service_get_parent (service);
-
-	tracker_db_interface_execute_procedure (iface,
-						NULL,
-						"IncStat",
-						service_type,
-						NULL);
-
-	if (parent) {
-		tracker_db_interface_execute_procedure (iface,
-							NULL,
-							"IncStat",
-							parent,
-							NULL);
-	}
-}
-
-void
-tracker_data_update_decrement_stats (TrackerDBInterface *iface,
-				     TrackerService     *service)
-{
-	const gchar *service_type, *parent;
-
-	service_type = tracker_service_get_name (service);
-	parent = tracker_service_get_parent (service);
-
-	tracker_db_interface_execute_procedure (iface,
-						NULL,
-						"DecStat",
-						service_type,
-						NULL);
-
-	if (parent) {
-		tracker_db_interface_execute_procedure (iface,
-							NULL,
-							"DecStat",
-							parent,
-							NULL);
-	}
-}
-
-void
 tracker_data_update_create_event (TrackerDBInterface *iface,
 				  guint32 service_id,
 				  const gchar *type)
@@ -163,7 +115,7 @@
 {
 	TrackerDBInterface *iface;
 	TrackerDBResultSet *result_set;
-	guint32	volume_id = 0;
+	guint32	volume_id = 1;
 	gchar *id_str, *service_type_id_str, *path, *volume_id_str;
 	gboolean is_dir, is_symlink;
 

Modified: trunk/src/libtracker-data/tracker-data-update.h
==============================================================================
--- trunk/src/libtracker-data/tracker-data-update.h	(original)
+++ trunk/src/libtracker-data/tracker-data-update.h	Tue Feb 24 15:42:58 2009
@@ -33,10 +33,6 @@
 G_BEGIN_DECLS
 
 guint32  tracker_data_update_get_new_service_id         (TrackerDBInterface  *iface);
-void     tracker_data_update_increment_stats            (TrackerDBInterface  *iface,
-							 TrackerService      *service);
-void     tracker_data_update_decrement_stats            (TrackerDBInterface  *iface,
-							 TrackerService      *service);
 
 /* Services  */
 gboolean tracker_data_update_create_service             (TrackerService      *service,

Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c	(original)
+++ trunk/src/tracker-indexer/tracker-indexer.c	Tue Feb 24 15:42:58 2009
@@ -1410,7 +1410,6 @@
 						    data);
 
 		tracker_data_update_create_event (indexer->private->cache, id, "Create");
-		tracker_data_update_increment_stats (indexer->private->common, service);
 
 		index_metadata (indexer, id, service, metadata);
 
@@ -1847,8 +1846,6 @@
 						      tracker_service_get_name (service));
 	}
 
-	tracker_data_update_decrement_stats (indexer->private->common, service);
-
 	g_free (mount_point);
 	g_free (path);
 }



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