summaryrefslogtreecommitdiff
path: root/src/tracker
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-08-19 11:21:34 +0200
committerCarlos Garnacho <carlosg@gnome.org>2020-08-19 13:30:28 +0200
commit99d8fc64a9006a2b656ab3a2f7268915113f17a0 (patch)
tree9c811a84af6d3147f7952732db35dc8bbcc4ca37 /src/tracker
parent47ccb7b5f549dfb83e3f6c24c7164742d41a6227 (diff)
downloadtracker-99d8fc64a9006a2b656ab3a2f7268915113f17a0.tar.gz
tracker: Add pager support to "tracker3 sql" command
Diffstat (limited to 'src/tracker')
-rw-r--r--src/tracker/tracker-sql.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tracker/tracker-sql.c b/src/tracker/tracker-sql.c
index 533b3ccc1..493e09f33 100644
--- a/src/tracker/tracker-sql.c
+++ b/src/tracker/tracker-sql.c
@@ -102,6 +102,7 @@ sql_by_query (void)
gint n_rows = 0;
GFile *db_location;
TrackerDataManager *data_manager;
+ gint retval = EXIT_SUCCESS;
db_location = g_file_new_for_commandline_arg (database_path);
data_manager = tracker_data_manager_new (TRACKER_DB_MANAGER_READONLY,
@@ -116,6 +117,8 @@ sql_by_query (void)
return EXIT_FAILURE;
}
+ tracker_term_pipe_to_pager ();
+
g_print ("--------------------------------------------------\n");
g_print ("\n\n");
@@ -132,8 +135,8 @@ sql_by_query (void)
_("Could not run query"),
error->message);
g_error_free (error);
-
- return EXIT_FAILURE;
+ retval = EXIT_FAILURE;
+ goto out;
}
g_print ("%s:\n", _("Results"));
@@ -165,15 +168,18 @@ sql_by_query (void)
_("Could not run query"),
error->message);
g_error_free (error);
-
- return EXIT_FAILURE;
+ retval = EXIT_FAILURE;
+ goto out;
}
if (n_rows == 0) {
g_print ("%s\n", _("Empty result set"));
}
- return EXIT_SUCCESS;
+out:
+ tracker_term_pager_close ();
+
+ return retval;
}
static int