summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tracker/tracker-info.c2
-rw-r--r--src/tracker/tracker-sparql.c23
-rw-r--r--src/tracker/tracker-sparql.h2
3 files changed, 7 insertions, 20 deletions
diff --git a/src/tracker/tracker-info.c b/src/tracker/tracker-info.c
index 7c94cc90b..169d26413 100644
--- a/src/tracker/tracker-info.c
+++ b/src/tracker/tracker-info.c
@@ -312,7 +312,7 @@ info_run (void)
return EXIT_FAILURE;
}
- prefixes = tracker_sparql_get_prefixes ();
+ prefixes = tracker_sparql_get_prefixes (connection);
/* print all prefixes if using turtle format and not showing full namespaces */
if (turtle && !full_namespaces) {
diff --git a/src/tracker/tracker-sparql.c b/src/tracker/tracker-sparql.c
index 94923deed..f1c892abe 100644
--- a/src/tracker/tracker-sparql.c
+++ b/src/tracker/tracker-sparql.c
@@ -193,24 +193,13 @@ create_connection (GError **error)
}
GHashTable *
-tracker_sparql_get_prefixes (void)
+tracker_sparql_get_prefixes (TrackerSparqlConnection *connection)
{
- TrackerSparqlConnection *connection;
TrackerSparqlCursor *cursor;
GError *error = NULL;
GHashTable *retval;
const gchar *query;
- connection = create_connection (&error);
-
- if (!connection) {
- g_printerr ("%s: %s\n",
- _("Could not establish a connection to Tracker"),
- error ? error->message : _("No error given"));
- g_clear_error (&error);
- return NULL;
- }
-
retval = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -229,8 +218,6 @@ tracker_sparql_get_prefixes (void)
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
- g_object_unref (connection);
-
if (error) {
g_printerr ("%s, %s\n",
_("Unable to retrieve namespace prefixes"),
@@ -981,7 +968,7 @@ tree_get (TrackerSparqlConnection *connection,
root = tree_new ();
/* Get shorthand prefixes for printing / filtering */
- prefixes = tracker_sparql_get_prefixes ();
+ prefixes = tracker_sparql_get_prefixes (connection);
/* Is class_lookup a shothand string, e.g. nfo:FileDataObject? */
if (class_lookup && *class_lookup && strchr (class_lookup, ':')) {
@@ -1355,7 +1342,7 @@ sparql_run (void)
}
if (get_shorthand) {
- GHashTable *prefixes = tracker_sparql_get_prefixes ();
+ GHashTable *prefixes = tracker_sparql_get_prefixes (connection);
gchar *result;
result = tracker_sparql_get_shorthand (prefixes, get_shorthand);
@@ -1368,7 +1355,7 @@ sparql_run (void)
}
if (get_longhand) {
- GHashTable *prefixes = tracker_sparql_get_prefixes ();
+ GHashTable *prefixes = tracker_sparql_get_prefixes (connection);
gchar *result;
result = tracker_sparql_get_longhand (prefixes, get_longhand);
@@ -1459,7 +1446,7 @@ sparql_run (void)
GHashTable *prefixes = NULL;
if (strstr (query, "fts:offsets")) {
- prefixes = tracker_sparql_get_prefixes ();
+ prefixes = tracker_sparql_get_prefixes (connection);
}
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
diff --git a/src/tracker/tracker-sparql.h b/src/tracker/tracker-sparql.h
index c8601dd8b..c5a03a8e0 100644
--- a/src/tracker/tracker-sparql.h
+++ b/src/tracker/tracker-sparql.h
@@ -27,7 +27,7 @@
int tracker_sparql (int argc,
const char **argv);
-GHashTable *tracker_sparql_get_prefixes (void);
+GHashTable *tracker_sparql_get_prefixes (TrackerSparqlConnection *connection);
gchar * tracker_sparql_get_longhand (GHashTable *prefixes,
const gchar *shorthand);
gchar * tracker_sparql_get_shorthand (GHashTable *prefixes,