]> 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>
Mon, 2 Aug 2010 14:53:54 +0000 (16:53 +0200)
bacula/src/cats/cats.h
bacula/src/cats/sql_get.c

index 8908fbae9581b5af253aae5a32764789caaf3325..381f4c46aacfab3fe2fcabae0f89ada4c09959f0 100644 (file)
@@ -1129,9 +1129,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 04f72849c325d50e21c2fbf488e5ad7d0d3912e7..7b9044b4eaa4ce45a3bdf38bd2e05fd03d612416 100644 (file)
@@ -1168,8 +1168,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->list[0] = 0;
-   jobids->count = 0;
+   jobids->reset();
 
    /* First, find the last good Full backup for this job/client/fileset */
    Mmsg(query, create_temp_accurate_jobids[db_type],