From 5ae2f5f58dcc9c0ce0818184b17f9e79a2ab17be Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 18 Jun 2010 09:02:34 +0200 Subject: [PATCH] Fix accurate code --- bacula/src/cats/cats.h | 13 +++++++++++-- bacula/src/cats/sql_get.c | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 674d57bb33..065eb06434 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -1165,9 +1165,18 @@ public: POOLMEM *list; /* list */ int count; /* number of values seen */ - db_list_ctx() { list = get_pool_memory(PM_FNAME); *list = 0; count = 0; } + db_list_ctx() { list = get_pool_memory(PM_FNAME); reset(); } ~db_list_ctx() { free_pool_memory(list); list = NULL; } - + void reset() { *list = 0; count = 0;} + void cat(const db_list_ctx &str) { + if (str.count > 0) { + if (*list) { + pm_strcat(list, ","); + } + pm_strcat(list, str.list); + count += str.count; + } + } private: db_list_ctx(const db_list_ctx&); /* prohibit pass by value */ db_list_ctx &operator=(const db_list_ctx&); /* prohibit class assignment */ diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index aee3d5d1f3..9f084a2c45 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1159,6 +1159,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, utime_t StartTime = (jr->StartTime)?jr->StartTime:time(NULL); bstrutime(date, sizeof(date), StartTime + 1); + jobids->reset(); /* First, find the last good Full backup for this job/client/fileset */ Mmsg(query, -- 2.39.5