From: Eric Bollengier Date: Thu, 17 Sep 2009 14:32:40 +0000 (+0200) Subject: Restore comments X-Git-Tag: Release-5.0.0~301 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0b215cc90a1937158d39ede9f00a20325ee7b622;p=bacula%2Fbacula Restore comments --- diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index 5017e878ca..cc92f5f4f1 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -467,22 +467,22 @@ const char *select_recent_version_with_basejob[4] = { "FROM Job, File, ( " "SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId " "FROM ( " - "SELECT JobTDate, PathId, FilenameId " - "FROM File JOIN Job USING (JobId) " + "SELECT JobTDate, PathId, FilenameId " /* Get all normal files */ + "FROM File JOIN Job USING (JobId) " /* from selected backup */ "WHERE JobId IN (%s) " "UNION ALL " - "SELECT JobTDate, PathId, FilenameId " - "FROM BaseFiles " + "SELECT JobTDate, PathId, FilenameId " /* Get all files from */ + "FROM BaseFiles " /* BaseJob */ "JOIN File USING (FileId) " "JOIN Job ON (BaseJobId = Job.JobId) " - "WHERE BaseFiles.JobId IN (%s) " - ") AS tmp GROUP BY PathId, FilenameId " + "WHERE BaseFiles.JobId IN (%s) " /* Use Max(JobTDate) to find */ + ") AS tmp GROUP BY PathId, FilenameId " /* the latest file version */ ") AS T1 " -"WHERE (Job.JobId IN ( " +"WHERE (Job.JobId IN ( " /* Security, we force JobId to be valid */ "SELECT DISTINCT BaseJobId FROM BaseFiles WHERE JobId IN (%s)) " "OR Job.JobId IN (%s)) " - "AND T1.JobTDate = Job.JobTDate " - "AND Job.JobId = File.JobId " + "AND T1.JobTDate = Job.JobTDate " /* Join on JobTDate to get the orginal */ + "AND Job.JobId = File.JobId " /* Job/File record */ "AND T1.PathId = File.PathId " "AND T1.FilenameId = File.FilenameId",