rx->JobIds[0] = 0;
}
rx->found = false;
+ rx->JobId = 0;
/* Find and insert jobid and File Index */
if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {
ua->error_msg(_("Query failed: %s. ERR=%s\n"),
Mmsg(rx->query, uar_jobid_fileindex_from_dir[db_get_type_index(ua->db)], rx->JobIds, dir, rx->ClientName);
}
rx->found = false;
- rx->JobId = 0; /* The jobid_fileindex_handler uses JobId to fill JobIds if needed */
/* Find and insert jobid and File Index */
if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {
Mmsg(rx->query, uar_jobid_fileindex_from_table, table);
rx->found = false;
+
/* Find and insert jobid and File Index. The JobIds are stored in rx->JobIds */
if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {
ua->error_msg(_("Query failed: %s. ERR=%s\n"),
*
* It will permit to find restore objects to send during the restore
*/
- if (rx->JobId == 0) { /* Avoid to duplicate the JobId inside JobIds */
+ if (!rx->found) {
rx->JobId = JobId;
}
- if (rx->JobId != JobId) {
+ if (*rx->JobIds == '\0' || rx->JobId != JobId) {
if (*rx->JobIds) {
pm_strcat(rx->JobIds, ",");
}