]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix accurate code
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 18 Jun 2010 07:02:34 +0000 (09:02 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Fri, 18 Jun 2010 14:01:49 +0000 (16:01 +0200)
bacula/src/cats/cats.h
bacula/src/cats/sql_get.c

index 674d57bb33a3803808121948c7869be1a5802d78..065eb064342cf82db925cfb521d891241c316908 100644 (file)
@@ -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 */
index aee3d5d1f312a976fde16dd51efcb2e1748c82a0..9f084a2c458ec94fdbb63d37cfb3c8532ec16f28 100644 (file)
@@ -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,