char clientid[50], jobid[50], filesetid[50];
char date[MAX_TIME_LENGTH];
POOL_MEM query(PM_FNAME);
- bstrutime(date, sizeof(date), time(NULL) + 1);
+ bstrutime(date, sizeof(date), jr->JobTDate + 1);
jobids[0]='\0';
/* First, find the last good Full backup for this job/client/fileset */
"WHERE ClientId = %s "
"AND Level='D' AND JobStatus IN ('T','W') AND Type='B' "
"AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 1) "
+ "AND StartTime < '%s' "
"AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) "
"ORDER BY Job.JobTDate DESC LIMIT 1 ",
jobid,
clientid,
jobid,
+ date,
filesetid);
if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) {
"WHERE ClientId = %s "
"AND Level='I' AND JobStatus IN ('T','W') AND Type='B' "
"AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 1) "
+ "AND StartTime < '%s' "
"AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) "
"ORDER BY Job.JobTDate DESC ",
jobid,
clientid,
jobid,
+ date,
filesetid);
if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) {
goto bail_out;
_("Find the JobIds of the most recent backup for a client"),
_("Find the JobIds for a backup for a client before a specified time"),
_("Enter a list of directories to restore for found JobIds"),
+ _("Select full restore to a specified JobId"),
_("Cancel"),
NULL };
}
return 2;
- case 11: /* Cancel or quit */
+ case 11: /* Choose a jobid and select jobs */
+ if (!get_cmd(ua, _("Enter JobId to restore: ")) ||
+ !is_an_integer(ua->cmd))
+ {
+ return 0;
+ }
+
+ memset(&jr, 0, sizeof(JOB_DBR));
+ jr.JobId = str_to_int64(ua->cmd);
+ if (!db_get_job_record(ua->jcr, ua->db, &jr)) {
+ ua->error_msg(_("Unable to get Job record for JobId=%s: ERR=%s\n"),
+ ua->cmd, db_strerror(ua->db));
+ return 0;
+ }
+ jr.JobLevel = L_INCREMENTAL; /* Take Full+Diff+Incr */
+ if (!db_accurate_get_jobids(ua->jcr, ua->db, &jr, rx->JobIds)) {
+ return 0;
+ }
+ Dmsg1(30, "Item 12: jobids = %s\n", rx->JobIds);
+ break;
+ case 12: /* Cancel or quit */
return 0;
}
}
+ memset(&jr, 0, sizeof(JOB_DBR));
POOLMEM *JobIds = get_pool_memory(PM_FNAME);
*JobIds = 0;
rx->TotalFiles = 0;
if (!db_sql_query(ua->db, rx->query, NULL, NULL)) {
ua->warning_msg("%s\n", db_strerror(ua->db));
}
- /* Now update JobTDate to lock onto Differental, if any */
+ /* Now update JobTDate to look into Differental, if any */
rx->JobTDate = 0;
if (!db_sql_query(ua->db, uar_sel_all_temp, last_full_handler, (void *)rx)) {
ua->warning_msg("%s\n", db_strerror(ua->db));