[tracker-miners/wip/carlosg/tracker-3.0-api-breaks: 29/57] tracker: Update "tracker status -a" command to not use statistics API



commit da7a1f9c3c3564ca035d5bda6e77c51e7a4f184f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Dec 24 09:11:34 2019 +0100

    tracker: Update "tracker status -a" command to not use statistics API
    
    This is going away, so perform a similar query in place.

 src/tracker/tracker-status.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker/tracker-status.c b/src/tracker/tracker-status.c
index 690725c7b..73765b0fa 100644
--- a/src/tracker/tracker-status.c
+++ b/src/tracker/tracker-status.c
@@ -58,6 +58,20 @@ static GOptionEntry entries[] = {
        { NULL }
 };
 
+static TrackerSparqlCursor *
+statistics_query (TrackerSparqlConnection  *connection,
+                 GError                  **error)
+{
+       return tracker_sparql_connection_query (connection,
+                                               "SELECT ?class (COUNT(?elem) AS ?count) {"
+                                               "  ?class a rdfs:Class . "
+                                               "  ?elem a ?class . "
+                                               "} "
+                                               "GROUP BY ?class "
+                                               "ORDER BY DESC count(?elem) ",
+                                               NULL, error);
+}
+
 static int
 status_stat (void)
 {
@@ -75,7 +89,7 @@ status_stat (void)
                return EXIT_FAILURE;
        }
 
-       cursor = tracker_sparql_connection_statistics (connection, NULL, &error);
+       cursor = statistics_query (connection, &error);
 
        g_object_unref (connection);
 
@@ -304,7 +318,7 @@ collect_debug (void)
        } else {
                TrackerSparqlCursor *cursor;
 
-               cursor = tracker_sparql_connection_statistics (connection, NULL, &error);
+               cursor = statistics_query (connection, &error);
 
                if (error) {
                        g_print ("** %s, %s **\n",


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