static int get_date(UAContext *ua, char *date, int date_len);
static int restore_count_handler(void *ctx, int num_fields, char **row);
static bool insert_table_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *table);
+static void get_and_display_basejobs(UAContext *ua, RESTORE_CTX *rx);
/*
* Restore files
case 0: /* error */
goto bail_out;
case 1: /* selected by jobid */
+ get_and_display_basejobs(ua, &rx);
if (!build_directory_tree(ua, &rx)) {
ua->send_msg(_("Restore not done.\n"));
goto bail_out;
}
+/*
+ * Fill the rx->BaseJobIds and display the list
+ */
+static void get_and_display_basejobs(UAContext *ua, RESTORE_CTX *rx)
+{
+ rx->BaseJobIds[0] = '\0';
+
+ if (!db_get_used_base_jobids(ua->jcr, ua->db, rx->JobIds, rx->BaseJobIds)) {
+ ua->warning_msg("%s", db_strerror(ua->db));
+ }
+
+ if (*rx->BaseJobIds) {
+ POOL_MEM q;
+ Mmsg(q, uar_print_jobs, rx->BaseJobIds);
+ ua->send_msg(_("The restore will use the following job(s) as Base\n"));
+ db_list_sql_query(ua->jcr, ua->db, q.c_str(), prtit, ua, 1, HORZ_LIST);
+ }
+}
+
static void free_rx(RESTORE_CTX *rx)
{
free_bsr(rx->bsr);
NULL
};
- rx->BaseJobIds[0] = rx->JobIds[0] = 0;
+ rx->JobIds[0] = 0;
for (i=1; i<ua->argc; i++) { /* loop through arguments */
bool found_kw = false;
}
/* Get the JobIds from that list */
- rx->last_jobid[0] = rx->BaseJobIds[0] = rx->JobIds[0] = 0;
+ rx->last_jobid[0] = rx->JobIds[0] = 0;
if (!db_sql_query(ua->db, uar_sel_jobid_temp, jobid_handler, (void *)rx)) {
ua->warning_msg("%s\n", db_strerror(ua->db));
prtit, ua, HORZ_LIST);
}
/* Display a list of Jobs selected for this restore */
- db_list_sql_query(ua->jcr, ua->db, uar_list_temp, prtit, ua, 1, HORZ_LIST);
+ db_list_sql_query(ua->jcr, ua->db, uar_list_temp, prtit, ua, 1,HORZ_LIST);
ok = true;
- if (!db_get_used_base_jobids(ua->jcr, ua->db, rx->JobIds, rx->BaseJobIds)) {
- ua->warning_msg("%s", db_strerror(ua->db));
- }
-
- if (*rx->BaseJobIds) {
- POOL_MEM buf;
- Mmsg(buf, uar_print_jobs, rx->BaseJobIds);
- ua->send_msg(_("The restore will use the following job(s) as Base\n"));
- db_list_sql_query(ua->jcr, ua->db, buf.c_str(), prtit, ua, 1, HORZ_LIST);
- }
-
} else {
ua->warning_msg(_("No jobs found.\n"));
}