tracker r1516 - in branches/xesam-support: . data src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1516 - in branches/xesam-support: . data src/trackerd
- Date: Wed, 28 May 2008 13:32:05 +0000 (UTC)
Author: pvanhoof
Date: Wed May 28 13:32:04 2008
New Revision: 1516
URL: http://svn.gnome.org/viewvc/tracker?rev=1516&view=rev
Log:
2008-05-28 Philip Van Hoof <pvanhoof gnome org>
* src/trackerd/tracker-xesam-live-search.c:
* src/trackerd/tracker-db-sqlite.c:
* src/trackerd/tracker-db-sqlite.h:
* data/sqlite-stored-procs.sql:
Detecting Creates, fixed the initial HitsAdded after StartSearch
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/data/sqlite-stored-procs.sql
branches/xesam-support/src/trackerd/tracker-db-sqlite.c
branches/xesam-support/src/trackerd/tracker-db-sqlite.h
branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
Modified: branches/xesam-support/data/sqlite-stored-procs.sql
==============================================================================
--- branches/xesam-support/data/sqlite-stored-procs.sql (original)
+++ branches/xesam-support/data/sqlite-stored-procs.sql Wed May 28 13:32:04 2008
@@ -29,6 +29,7 @@
GetEvents SELECT ID, ServiceID, EventType FROM Events WHERE BeingHandled = 1;
SetEventsBeingHandled UPDATE Events SET BeingHandled = 1;
+GetLiveSearchAllIDs SELECT X.ServiceID FROM LiveSearches AS X WHERE X.SearchID = ?
GetLiveSearchDeletedIDs SELECT E.ServiceID FROM Events as E, LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType IS 'Delete';
DeleteLiveSearchDeletedIDs DELETE FROM LiveSearches AS Y WHERE Y.ServiceID IN SELECT ServiceID FROM Events as E, LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType IS 'Delete'
Modified: branches/xesam-support/src/trackerd/tracker-db-sqlite.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-sqlite.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db-sqlite.c Wed May 28 13:32:04 2008
@@ -3355,7 +3355,7 @@
}
TrackerDBResultSet*
-tracker_db_get_live_search_new_ids (DBConnection *db_con, const gchar *search_id, const gchar *columns, const gchar *from_query, const gchar *join_query, const gchar *where_query)
+tracker_db_get_live_search_new_ids (DBConnection *db_con, const gchar *search_id, const gchar *from_query, const gchar *query_joins, const gchar *where_query)
{
TrackerDBResultSet *result_set;
@@ -3365,97 +3365,98 @@
* ServiceID is #1
* EventType is #2 */
- // todo: we will only find updates with this one
+ g_debug("tracker_db_get_live_search_new_ids");
+
/**
- * SELECT E.ServiceID, E.EventType, COLUMNS
- * FROM_QUERY LiveSearches as X, Events as E
- * WHERE_QUERY"
+ * SELECT E.ServiceID, E.EventType
+ * FROM_QUERY, LiveSearches as X, Events as E
+ * QUERY_JOINS
+ * WHERE_QUERY
* AND X.ServiceID = E.ServiceID
- * AND X.SearchID = SEARCH_ID
- * AND (X.EventType IS 'Create'
- * OR X.EventType IS 'Update')
+ * AND X.SearchID = 'SEARCH_ID'
+ * AND E.EventType = 'Update'
+ * UNION
+ * SELECT E.ServiceID, E.EventType
+ * FROM_QUERY, Events as E
+ * QUERY_JOINS
+ * WHERE_QUERY
+ * AND E.ServiceID = S.ID
**/
- // todo: we will only find updates with this one
/**
- * INSERT INTO LiveSearches SELECT E.ServiceID, SEARCH_ID
- * FROM_QUERY LiveSearches as X, Events as E
- * WHERE_QUERY"
- * AND X.ServiceID = E.ServiceID
- * AND X.SearchID = SEARCH_ID
- * AND (X.EventType IS 'Create'
- * OR X.EventType IS 'Update')
+ * INSERT INTO LiveSearches
+ * SELECT E.ServiceID, 'SEARCH_ID'
+ * FROM_QUERY, Events as E
+ * QUERY_JOINS
+ * WHERE_QUERY
+ * AND E.ServiceID = S.ID
**/
- g_debug("tracker_db_get_live_search_new_ids");
-
result_set = tracker_db_exec (db_con->db,
- /* COLUMNS */ "SELECT E.ServiceID, E.EventType%s%s "
- /* FROM_QUERY */ "%s%s LiveSearches as X, Events as E "
- /* WHERE_QUERY */ "%s"
- /* AND or space */ "%sX.ServiceID = E.ServiceID "
- "AND X.SearchID = '%s' " /* search_id arg */
- "AND (X.EventType IS 'Create' "
- "OR X.EventType IS 'Update') ",
-
- columns?", ":"",
- columns?columns:"",
- from_query?from_query:"FROM",
- from_query?",":"",
- where_query?where_query:"WHERE",
- where_query?"AND":" ",
- search_id);
+/* */ "SELECT E.ServiceID, E.EventType "
+/* FROM A1 */ "%s%s LiveSearches as X, Events as E "
+/* JOINS A2 */ "%s"
+/* WHERE A3 */ "%s"
+/* */ "%sX.ServiceID = E.ServiceID "
+/* A4 */ "AND X.SearchID = '%s' "
+/* */ "AND E.EventType = 'Update' "
+
+/* */ "UNION "
+
+/* */ "SELECT E.ServiceID, E.EventType "
+/* FROM B1 */ "%s%s Events as E "
+/* JOINS B2 */ "%s"
+/* WHERE B3 */ "%s"
+/* */ "%sE.ServiceID = S.ID",
+
+/* A1 */ from_query?from_query:"FROM",
+/* A1 */ from_query?",":"",
+/* A2 */ query_joins,
+/* A3 */ where_query?where_query:"WHERE",
+/* A3 */ where_query?"AND ":"",
+/* A4 */ search_id,
+/* B1 */ from_query?from_query:"FROM",
+/* B1 */ from_query?",":"",
+/* B2 */ query_joins,
+/* B3 */ where_query?where_query:"WHERE",
+/* B3 */ where_query?"AND ":"");
+
-
tracker_db_exec_no_reply (db_con->db,
- "INSERT INTO LiveSearches SELECT E.ServiceID, '%s' "
- /* FROM_QUERY */ "%s%s LiveSearches as X, Events as E "
- /* WHERE_QUERY */ "%s"
- /* AND or space */ "%sX.ServiceID = E.ServiceID "
- "AND X.SearchID = '%s' " /* search_id arg */
- "AND (X.EventType IS 'Create') ",
- search_id,
- from_query?from_query:"FROM",
- from_query?",":"",
- where_query?where_query:"WHERE",
- where_query?"AND ":" ",
- search_id);
+/* */ "INSERT INTO LiveSearches "
+/* B0 */ "SELECT E.ServiceID, '%s' "
+/* FROM B1 */ "%s%s Events as E "
+/* JOINS B2 */ "%s"
+/* WHERE B3 */ "%s"
+/* */ "%sE.ServiceID = S.ID",
+
+/* B0 */ search_id,
+/* B1 */ from_query?from_query:"FROM",
+/* B1 */ from_query?",":"",
+/* B2 */ query_joins,
+/* B3 */ where_query?where_query:"WHERE",
+/* B3 */ where_query?"AND ":"");
return result_set;
}
TrackerDBResultSet*
-tracker_db_get_live_search_all_ids (DBConnection *db_con, const gchar *search_id, const gchar *columns, const gchar *from_query, const gchar *join_query, const gchar *where_query)
+tracker_db_get_live_search_all_ids (DBConnection *db_con, const gchar *search_id)
{
- // todo: this is a query for ottela to review
-
/* Contract, in @result:
- * ServiceID is #1
- * EventType is #2 */
+ * ServiceID is #1 */
/**
- * SELECT E.ServiceID, COLUMNS
- * FROM_QUERY XesamLiveSearches as X
- * WHERE_QUERY
- * AND X.SearchID = SEARCH_ID
+ * SELECT X.ServiceID
+ * FROM LiveSearches as X
+ * WHERE X.SearchID = SEARCH_ID
**/
g_debug("tracker_db_get_live_search_all_ids");
- return tracker_db_exec (db_con->db,
- /* COLUMNS */ "SELECT E.ServiceID%s%s "
- /* FROM_QUERY */ "%s%s LiveSearches as X "
- /* WHERE_QUERY */ "%s"
- /* AND or space */ "%X.SearchID = '%s' " /* search_id arg */,
-
- columns?", ":"",
- columns?columns:"",
- from_query?from_query:"FROM",
- from_query?",":"",
- where_query?where_query:"WHERE",
- where_query?"AND ":" ",
- search_id);
+ return tracker_db_exec_proc (db_con->db, "GetLiveSearchAllIDs", search_id, NULL);
+
}
TrackerDBResultSet *
Modified: branches/xesam-support/src/trackerd/tracker-db-sqlite.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-sqlite.h (original)
+++ branches/xesam-support/src/trackerd/tracker-db-sqlite.h Wed May 28 13:32:04 2008
@@ -327,16 +327,11 @@
const gchar *search_id);
TrackerDBResultSet *tracker_db_get_live_search_new_ids (DBConnection *db_con,
const gchar *search_id,
- const gchar *columns,
- const gchar *from_query,
- const gchar *join_query,
- const gchar *where_query);
-TrackerDBResultSet *tracker_db_get_live_search_all_ids (DBConnection *db_con,
- const gchar *search_id,
- const gchar *columns,
const gchar *from_query,
- const gchar *join_query,
+ const gchar *query_joins,
const gchar *where_query);
+TrackerDBResultSet *tracker_db_get_live_search_all_ids (DBConnection *db_con,
+ const gchar *search_id);
TrackerDBResultSet *tracker_db_get_live_search_hit_count (DBConnection *db_con,
const gchar *search_id);
Modified: branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-live-search.c (original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-live-search.c Wed May 28 13:32:04 2008
@@ -225,9 +225,8 @@
result_set = tracker_db_get_live_search_new_ids (db_con,
tracker_xesam_live_search_get_id (self),
- NULL, /* Columns */
tracker_xesam_live_search_get_from_query (self),
- tracker_xesam_live_search_get_join_query (self),
+ tracker_xesam_live_search_get_join_query (self),
tracker_xesam_live_search_get_where_query (self)); /* Query */
if (!result_set)
@@ -290,11 +289,7 @@
TrackerDBResultSet *result_set;
result_set = tracker_db_get_live_search_all_ids (db_con,
- tracker_xesam_live_search_get_id (self),
- NULL, /* Columns */
- tracker_xesam_live_search_get_from_query (self),
- tracker_xesam_live_search_get_join_query (self),
- tracker_xesam_live_search_get_where_query (self)); /* Query */
+ tracker_xesam_live_search_get_id (self));
if (!result_set)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]