[tracker/wip/carlosg/sparql-corners: 8/12] libtracker-data: Special case empty remote queries on services vtable
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/sparql-corners: 8/12] libtracker-data: Special case empty remote queries on services vtable
- Date: Mon, 1 Mar 2021 23:51:50 +0000 (UTC)
commit d8035fe97c435ee8d2b642fbaed2a91828f67368
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Feb 27 12:47:16 2021 +0100
libtracker-data: Special case empty remote queries on services vtable
Make these queries succeed, but come up empty. This is effectively the
same than asking the remote service for the empty graph pattern "{ }".
src/libtracker-data/tracker-vtab-service.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-vtab-service.c b/src/libtracker-data/tracker-vtab-service.c
index f141bd2a1..469f05f4d 100644
--- a/src/libtracker-data/tracker-vtab-service.c
+++ b/src/libtracker-data/tracker-vtab-service.c
@@ -296,6 +296,7 @@ service_filter (sqlite3_vtab_cursor *vtab_cursor,
TrackerSparqlStatement *statement;
GHashTable *names = NULL, *values = NULL;
GError *error = NULL;
+ gboolean empty_query = FALSE;
gint i;
cursor->finished = FALSE;
@@ -354,6 +355,11 @@ service_filter (sqlite3_vtab_cursor *vtab_cursor,
TRACKER_SPARQL_ERROR_PARSE,
"Query not given to services virtual table");
goto fail;
+ } else if (*cursor->query == '\0') {
+ g_clear_pointer (&names, g_hash_table_unref);
+ g_clear_pointer (&values, g_hash_table_unref);
+ cursor->finished = TRUE;
+ return SQLITE_OK;
}
connection = tracker_data_manager_get_remote_connection (module->data_manager,
@@ -389,9 +395,9 @@ fail:
g_clear_pointer (&names, g_hash_table_unref);
g_clear_pointer (&values, g_hash_table_unref);
- if (cursor->silent) {
+ if (cursor->silent || empty_query) {
cursor->finished = TRUE;
- g_error_free (error);
+ g_clear_error (&error);
return SQLITE_OK;
} else {
tracker_service_cursor_set_vtab_error (cursor, error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]