]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/sql_cmds.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / dird / sql_cmds.c
index 6ba94f151c74fff24151f074d3d1b5d9ef9ea1ca..6d8ffcb90ca9dc7cf9faa477047b59a4bec55281 100644 (file)
@@ -176,6 +176,10 @@ char *uar_file =
 #endif
 
 
+/*
+ * Find all files for a particular JobId and insert them into
+ *  the tree during a restore.
+ */
 char *uar_sel_files = 
    "SELECT Path.Path,Filename.Name,FileIndex,JobId,LStat "
    "FROM File,Filename,Path "
@@ -278,7 +282,7 @@ char *uar_list_temp =
    "ORDER BY StartTime ASC";
 
 
-char *uar_sel_jobid_temp = "SELECT JobId FROM temp";
+char *uar_sel_jobid_temp = "SELECT JobId FROM temp ORDER BY StartTime ASC";
 
 char *uar_sel_all_temp1 = "SELECT * FROM temp1";
 
@@ -298,7 +302,10 @@ char *uar_mediatype =
    "SELECT MediaType FROM JobMedia,Media WHERE JobMedia.JobId=%u "
    "AND JobMedia.MediaId=Media.MediaId";
 
-/* Find JobId, FileIndex for a given path/file and date */
+/* 
+ *  Find JobId, FileIndex for a given path/file and date   
+ *  for use when inserting individual files into the tree.
+ */
 char *uar_jobid_fileindex = 
    "SELECT Job.JobId, File.FileIndex FROM Job,File,Path,Filename,Client "
    "WHERE Job.JobId=File.JobId "
@@ -306,6 +313,7 @@ char *uar_jobid_fileindex =
    "AND Path.Path='%s' "
    "AND Filename.Name='%s' "
    "AND Client.Name='%s' "
+   "AND Job.ClientId=Client.ClientId "
    "AND Path.PathId=File.PathId "
    "AND Filename.FilenameId=File.FilenameId "
    "ORDER BY Job.StartTime DESC LIMIT 1";