[gnome-photos] query-builder: Add photos_query_builder_count_query



commit e60d532ac51bcf0284a79cb0a79313c2d8e7b1c8
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Aug 11 15:45:51 2012 +0200

    query-builder: Add photos_query_builder_count_query

 src/photos-query-builder.c |   18 ++++++++++++++++++
 src/photos-query-builder.h |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 7dc75b8..229fc8c 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -149,6 +149,24 @@ photos_query_builder_query (gboolean global, gint flags)
 
 
 PhotosQuery *
+photos_query_builder_count_query (void)
+{
+  gchar *filter;
+  gchar *optional;
+  gchar *sparql;
+
+  filter = photos_query_builder_filter ();
+  optional = photos_query_builder_optional ();
+  sparql = g_strconcat ("SELECT DISTINCT COUNT(?urn) WHERE { ", optional, filter, " }", NULL);
+
+  g_free (optional);
+  g_free (filter);
+
+  return photos_query_new (sparql);
+}
+
+
+PhotosQuery *
 photos_query_builder_global_query (void)
 {
   gchar *sparql;
diff --git a/src/photos-query-builder.h b/src/photos-query-builder.h
index b1fde82..a4fa94d 100644
--- a/src/photos-query-builder.h
+++ b/src/photos-query-builder.h
@@ -25,6 +25,8 @@
 
 G_BEGIN_DECLS
 
+PhotosQuery  *photos_query_builder_count_query         (void);
+
 PhotosQuery  *photos_query_builder_global_query        (void);
 
 gchar        *photos_query_builder_filter_local        (void);



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