From: Eric Bollengier Date: Thu, 17 Sep 2009 14:27:21 +0000 (+0200) Subject: Fix for sqlite, now it works X-Git-Tag: Release-7.0.0~2619 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b0e207d5a6a75d2cc7369dfbaa46ece695d9ecd5;p=bacula%2Fbacula Fix for sqlite, now it works --- diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index 41520c9e7e..5017e878ca 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -481,10 +481,10 @@ const char *select_recent_version_with_basejob[4] = { "WHERE (Job.JobId IN ( " "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 Job.JobTDate = T1.JobTDate " - "AND File.PathId = T1.PathId " - "AND File.FilenameId = T1.PathId " + "AND T1.PathId = File.PathId " + "AND T1.FilenameId = File.FilenameId", /* Postgresql */ /* The DISTINCT ON () permits to avoid extra join */ "SELECT DISTINCT ON (FilenameId, PathId) StartTime, JobId, FileId, " @@ -520,10 +520,10 @@ const char *select_recent_version_with_basejob[4] = { "WHERE (Job.JobId IN ( " "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 Job.JobTDate = T1.JobTDate " - "AND File.PathId = T1.PathId " - "AND File.FilenameId = T1.PathId ", + "AND T1.PathId = File.PathId " + "AND T1.FilenameId = File.FilenameId", /* SQLite3 */ /* See Mysql section for doc */ "SELECT FileId, Job.JobId AS JobId, FileIndex, File.PathId AS PathId, " @@ -545,10 +545,10 @@ const char *select_recent_version_with_basejob[4] = { "WHERE (Job.JobId IN ( " "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 Job.JobTDate = T1.JobTDate " - "AND File.PathId = T1.PathId " - "AND File.FilenameId = T1.PathId " + "AND T1.PathId = File.PathId " + "AND T1.FilenameId = File.FilenameId" }; /* Get the list of the last recent version with a given BaseJob jobid list */ diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 1e5b569a15..b192eb9cf6 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1068,8 +1068,10 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, #define new_db_get_file_list #ifdef new_db_get_file_list POOL_MEM buf2(PM_MESSAGE); + Dmsg1(0, "sql=%s\n", select_recent_version_with_basejob[db_type]); Mmsg(buf2, select_recent_version_with_basejob[db_type], - jobids, jobids, jobids); + jobids, jobids, jobids, jobids); + Dmsg1(0, "sql=%s\n", buf2.c_str()); Mmsg(buf, "SELECT Path.Path, Filename.Name, Temp.FileIndex, Temp.JobId, LStat, MD5 " "FROM ( %s ) AS Temp " diff --git a/regress/tests/base-job-test b/regress/tests/base-job-test index e553749143..1882e66107 100755 --- a/regress/tests/base-job-test +++ b/regress/tests/base-job-test @@ -107,8 +107,6 @@ if [ $? -ne 0 ]; then bstat=2 fi -ls -l ${cwd}/tmp/bacula-restores/tmp/regress/build/accurate/ - ################################################################ p Now do a backup after making few changes ################################################################ @@ -140,10 +138,6 @@ check_two_logs check_restore_diff check_files_written ${cwd}/tmp/log1.out 4 -ls -l ${cwd}/tmp/bacula-restores/tmp/regress/build/accurate/ - -exit 0 - rm -rf ${cwd}/tmp/bacula-restores ################################################################