2 This patch fixes a restore to permit specifying both a JobId and
3 a filename or list of files to be restored. Apply to 1.36.0 with:
6 patch -p0 <1.36.0-jobid-restore.patch
11 Index: src/dird/sql_cmds.c
12 ===================================================================
13 RCS file: /cvsroot/bacula/bacula/src/dird/sql_cmds.c,v
14 retrieving revision 1.43
15 diff -u -r1.43 sql_cmds.c
16 --- src/dird/sql_cmds.c 1 Sep 2004 19:44:28 -0000 1.43
17 +++ src/dird/sql_cmds.c 10 Nov 2004 20:38:46 -0000
19 "AND Path.PathId=File.PathId "
20 "AND Filename.FilenameId=File.FilenameId "
21 "ORDER BY Job.StartTime DESC LIMIT 1";
24 +const char *uar_jobids_fileindex =
25 + "SELECT Job.JobId, File.FileIndex FROM Job,File,Path,Filename,Client "
26 + "WHERE Job.JobId IN (%s) "
27 + "AND Job.JobId=File.JobId "
28 + "AND Job.StartTime<'%s' "
29 + "AND Path.Path='%s' "
30 + "AND Filename.Name='%s' "
31 + "AND Client.Name='%s' "
32 + "AND Job.ClientId=Client.ClientId "
33 + "AND Path.PathId=File.PathId "
34 + "AND Filename.FilenameId=File.FilenameId "
35 + "ORDER BY Job.StartTime DESC LIMIT 1";
36 Index: src/dird/ua_restore.c
37 ===================================================================
38 RCS file: /cvsroot/bacula/bacula/src/dird/ua_restore.c,v
39 retrieving revision 1.84
40 diff -u -r1.84 ua_restore.c
41 --- src/dird/ua_restore.c 15 Oct 2004 17:09:04 -0000 1.84
42 +++ src/dird/ua_restore.c 10 Nov 2004 20:38:46 -0000
44 extern char *uar_inc, *uar_list_temp, *uar_sel_jobid_temp;
45 extern char *uar_sel_all_temp1, *uar_sel_fileset, *uar_mediatype;
46 extern char *uar_jobid_fileindex, *uar_dif, *uar_sel_all_temp;
47 -extern char *uar_count_files;
48 +extern char *uar_count_files, *uar_jobids_fileindex;
54 strip_trailing_junk(file);
55 split_path_and_filename(rx, file);
56 - Mmsg(rx->query, uar_jobid_fileindex, date, rx->path, rx->fname, rx->ClientName);
57 + if (*rx->JobIds == 0) {
58 + Mmsg(rx->query, uar_jobid_fileindex, date, rx->path, rx->fname, rx->ClientName);
60 + Mmsg(rx->query, uar_jobids_fileindex, rx->JobIds, date,
61 + rx->path, rx->fname, rx->ClientName);
64 /* Find and insert jobid and File Index */
65 if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {