[gnome-photos/wip/rishi/de-dup: 3/9] query-builder: Don't use an undefined ?item variable
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/de-dup: 3/9] query-builder: Don't use an undefined ?item variable
- Date: Tue, 6 Sep 2016 18:47:46 +0000 (UTC)
commit 723eeb5bfe3aa5c1dc1d1997e67724165f5c6e22
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Sep 6 18:27:33 2016 +0200
query-builder: Don't use an undefined ?item variable
We can only use COUNT (?item), if ?item is defined in the WHERE clause.
Tracker has recently started being strict about this.
https://bugzilla.gnome.org/show_bug.cgi?id=770782
src/photos-query-builder.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index a0edb12..5b84b54 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -25,6 +25,8 @@
#include "config.h"
+#include <string.h>
+
#include <gio/gio.h>
#include "photos-base-manager.h"
@@ -107,12 +109,15 @@ static gchar *
photos_query_builder_where (PhotosSearchContextState *state, gboolean global, gint flags)
{
const gchar *count_items = "COUNT (?item) AS ?count";
+ gboolean item_defined;
gchar *filter = NULL;
gchar *optional;
gchar *sparql;
gchar *where_sparql;
where_sparql = photos_query_builder_inner_where (state, global, flags);
+ item_defined = strstr (where_sparql, "?item") != NULL;
+
optional = photos_query_builder_optional ();
if (!(flags & PHOTOS_QUERY_FLAGS_UNFILTERED))
@@ -123,7 +128,7 @@ photos_query_builder_where (PhotosSearchContextState *state, gboolean global, gi
" }"
" %s %s"
"}",
- count_items,
+ item_defined ? count_items : "",
where_sparql,
optional,
(filter != NULL) ? filter : "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]