Commit ce8829c6 authored by Martyn James Russell's avatar Martyn James Russell

Add $home as the first volume in the Volumes table with an id of 1 (has to

	* 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.

svn path=/trunk/; revision=2960
parent fc5233c6
2009-02-24 Martyn Russell <martyn@imendio.com>
* 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.
2009-02-24 Martyn Russell <martyn@imendio.com>
* src/tracker-extract/tracker-main.c:
......
......@@ -122,10 +122,7 @@ DeleteSearchResults1 DELETE FROM SearchResults1;
/*
* 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 @@ GetVolumesToClean SELECT VolumeID FROM Volumes WHERE DisabledDate <
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
......
......@@ -15,7 +15,7 @@ insert Into Options (OptionKey, OptionValue) values ('RssLastModseq', '0');
/* 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 @@ CREATE TABLE Volumes
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
......
......@@ -89,54 +89,6 @@ tracker_data_update_get_new_service_id (TrackerDBInterface *iface)
return ++max;
}
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,
......@@ -163,7 +115,7 @@ tracker_data_update_create_service (TrackerService *service,
{
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;
......
......@@ -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,
......
......@@ -1410,7 +1410,6 @@ item_add_or_update (TrackerIndexer *indexer,
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 @@ item_remove (TrackerIndexer *indexer,
tracker_service_get_name (service));
}
tracker_data_update_decrement_stats (indexer->private->common, service);
g_free (mount_point);
g_free (path);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment