[gnome-photos/wip/rishi/de-dup: 2/9] query-builder: Split out the COUNT into a separate variable



commit af79e7546c7ca5ce5f22b4a1842b044ab8f6721e
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Sep 6 18:12:27 2016 +0200

    query-builder: Split out the COUNT into a separate variable
    
    This will make the subsequent commit easier to read.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770782

 src/photos-query-builder.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index a16bc8e..a0edb12 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -106,6 +106,7 @@ photos_query_builder_inner_where (PhotosSearchContextState *state, gboolean glob
 static gchar *
 photos_query_builder_where (PhotosSearchContextState *state, gboolean global, gint flags)
 {
+  const gchar *count_items = "COUNT (?item) AS ?count";
   gchar *filter = NULL;
   gchar *optional;
   gchar *sparql;
@@ -118,10 +119,11 @@ photos_query_builder_where (PhotosSearchContextState *state, gboolean global, gi
     filter = photos_query_builder_filter (state, flags);
 
   sparql = g_strdup_printf ("WHERE {{"
-                            "    SELECT ?urn rdf:type (?urn) AS ?type COUNT (?item) AS ?count %s GROUP BY 
(?urn)"
+                            "    SELECT ?urn rdf:type (?urn) AS ?type %s %s GROUP BY (?urn)"
                             "  }"
                             "  %s %s"
                             "}",
+                            count_items,
                             where_sparql,
                             optional,
                             (filter != NULL) ? filter : "");


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