]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/cats.h
Fix postgresql version detection in database creation script
[bacula/bacula] / bacula / src / cats / cats.h
index 8f580e3a1eab5cd0927859d3327e3e3fddeafdce..e180cef198ebf9683a7d24e89e34ddc779a005c7 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -85,12 +85,14 @@ typedef int (DB_RESULT_HANDLER)(void *, int, char **);
 
 #ifdef __SQL_C
 
 
 #ifdef __SQL_C
 
+/* Current database version number for all drivers */
+#define BDB_VERSION 13
+
+
 #if defined(BUILDING_CATS)
 #ifdef HAVE_SQLITE
 #error "SQLite2 is now deprecated, use SQLite3 instead."
 
 #if defined(BUILDING_CATS)
 #ifdef HAVE_SQLITE
 #error "SQLite2 is now deprecated, use SQLite3 instead."
 
-#define BDB_VERSION 12
-
 #include <sqlite.h>
 
 /* Define opaque structure for sqlite */
 #include <sqlite.h>
 
 /* Define opaque structure for sqlite */
@@ -149,6 +151,7 @@ struct B_DB {
    POOLMEM *path;                     /* Path only */
    POOLMEM *esc_name;                 /* Escaped file name */
    POOLMEM *esc_path;                 /* Escaped path name */
    POOLMEM *path;                     /* Path only */
    POOLMEM *esc_name;                 /* Escaped file name */
    POOLMEM *esc_path;                 /* Escaped path name */
+   POOLMEM *esc_obj;                  /* Escaped restore object */
    int fnl;                           /* file name length */
    int pnl;                           /* path name length */
 };
    int fnl;                           /* file name length */
    int pnl;                           /* path name length */
 };
@@ -163,7 +166,7 @@ struct B_DB {
 #define sql_free_result(x)     my_sqlite_free_table(x)
 #define sql_fetch_row(x)       my_sqlite_fetch_row(x)
 #define sql_query(x, y)        my_sqlite_query((x), (y))
 #define sql_free_result(x)     my_sqlite_free_table(x)
 #define sql_fetch_row(x)       my_sqlite_fetch_row(x)
 #define sql_query(x, y)        my_sqlite_query((x), (y))
-#define sql_insert_id(x, y, z) my_sqlite_sql_insert_id((x), (y), (z))
+#define sql_insert_autokey_record(x, y, z) my_sqlite_insert_autokey_record((x), (y), (z))
 #ifdef HAVE_SQLITE3
 #define sql_close(x)           sqlite3_close((x)->db)
 #define sql_affected_rows(x)   sqlite3_changes((x)->db)
 #ifdef HAVE_SQLITE3
 #define sql_close(x)           sqlite3_close((x)->db)
 #define sql_affected_rows(x)   sqlite3_changes((x)->db)
@@ -195,7 +198,7 @@ SQL_ROW    my_sqlite_fetch_row(B_DB *mdb);
 int        my_sqlite_query(B_DB *mdb, const char *cmd);
 void       my_sqlite_field_seek(B_DB *mdb, int field);
 SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb);
 int        my_sqlite_query(B_DB *mdb, const char *cmd);
 void       my_sqlite_field_seek(B_DB *mdb, int field);
 SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb);
-int my_sqlite_sql_insert_id(B_DB *mdb, const char *query, const char *table_name);
+int my_sqlite_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
 extern const char* my_sqlite_batch_lock_query;
 extern const char* my_sqlite_batch_unlock_query;
 extern const char* my_sqlite_batch_fill_filename_query;
 extern const char* my_sqlite_batch_lock_query;
 extern const char* my_sqlite_batch_unlock_query;
 extern const char* my_sqlite_batch_fill_filename_query;
@@ -209,9 +212,6 @@ extern const char* my_sqlite_batch_fill_path_query;
 
 #ifdef HAVE_SQLITE3
 
 
 #ifdef HAVE_SQLITE3
 
-
-#define BDB_VERSION 12
-
 #include <sqlite3.h>
 
 /* Define opaque structure for sqlite */
 #include <sqlite3.h>
 
 /* Define opaque structure for sqlite */
@@ -270,6 +270,7 @@ struct B_DB {
    POOLMEM *path;                     /* Path only */
    POOLMEM *esc_name;                 /* Escaped file name */
    POOLMEM *esc_path;                 /* Escaped path name */
    POOLMEM *path;                     /* Path only */
    POOLMEM *esc_name;                 /* Escaped file name */
    POOLMEM *esc_path;                 /* Escaped path name */
+   POOLMEM *esc_obj;                  /* Escaped restore object */
    int fnl;                           /* file name length */
    int pnl;                           /* path name length */
 };
    int fnl;                           /* file name length */
    int pnl;                           /* path name length */
 };
@@ -291,24 +292,23 @@ struct B_DB {
  *
  *                    S Q L I T E 3
  */
  *
  *                    S Q L I T E 3
  */
-#define sql_store_result(x)   (x)->result
-#define sql_free_result(x)    my_sqlite_free_table(x)
-#define sql_fetch_row(x)      my_sqlite_fetch_row(x)
-#define sql_query(x, y)       my_sqlite_query((x), (y))
+#define sql_store_result(x)    (x)->result
+#define sql_free_result(x)     my_sqlite_free_table(x)
+#define sql_fetch_row(x)       my_sqlite_fetch_row(x)
+#define sql_query(x, y)        my_sqlite_query((x), (y))
+#define sql_insert_autokey_record(x, y, z) my_sqlite_insert_autokey_record((x), (y), (z))
 #ifdef HAVE_SQLITE3
 #ifdef HAVE_SQLITE3
-#define sql_insert_id(x,y)    sqlite3_last_insert_rowid((x)->db)
-#define sql_close(x)          sqlite3_close((x)->db)
+#define sql_close(x)           sqlite3_close((x)->db)
 #else
 #else
-#define sql_insert_id(x,y)    sqlite_last_insert_rowid((x)->db)
-#define sql_close(x)          sqlite_close((x)->db)
+#define sql_close(x)           sqlite_close((x)->db)
 #endif
 #endif
-#define sql_strerror(x)       (x)->sqlite_errmsg?(x)->sqlite_errmsg:"unknown"
-#define sql_num_rows(x)       (x)->nrow
-#define sql_data_seek(x, i)   (x)->row = (i)
-#define sql_affected_rows(x)  sqlite3_changes((x)->db)
-#define sql_field_seek(x, y)  my_sqlite_field_seek((x), (y))
-#define sql_fetch_field(x)    my_sqlite_fetch_field(x)
-#define sql_num_fields(x)     ((x)->ncolumn)
+#define sql_strerror(x)        (x)->sqlite_errmsg?(x)->sqlite_errmsg:"unknown"
+#define sql_num_rows(x)        (x)->nrow
+#define sql_data_seek(x, i)    (x)->row = (i)
+#define sql_affected_rows(x)   sqlite3_changes((x)->db)
+#define sql_field_seek(x, y)   my_sqlite_field_seek((x), (y))
+#define sql_fetch_field(x)     my_sqlite_fetch_field(x)
+#define sql_num_fields(x)      ((x)->ncolumn)
 #define sql_batch_start(x,y)    my_batch_start(x,y)
 #define sql_batch_end(x,y,z)    my_batch_end(x,y,z)
 #define sql_batch_insert(x,y,z) my_batch_insert(x,y,z)
 #define sql_batch_start(x,y)    my_batch_start(x,y)
 #define sql_batch_end(x,y,z)    my_batch_end(x,y,z)
 #define sql_batch_insert(x,y,z) my_batch_insert(x,y,z)
@@ -326,6 +326,7 @@ SQL_ROW    my_sqlite_fetch_row(B_DB *mdb);
 int        my_sqlite_query(B_DB *mdb, const char *cmd);
 void       my_sqlite_field_seek(B_DB *mdb, int field);
 SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb);
 int        my_sqlite_query(B_DB *mdb, const char *cmd);
 void       my_sqlite_field_seek(B_DB *mdb, int field);
 SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb);
+int        my_sqlite_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
 extern const char* my_sqlite_batch_lock_query;
 extern const char* my_sqlite_batch_unlock_query;
 extern const char* my_sqlite_batch_fill_filename_query;
 extern const char* my_sqlite_batch_lock_query;
 extern const char* my_sqlite_batch_unlock_query;
 extern const char* my_sqlite_batch_fill_filename_query;
@@ -336,8 +337,6 @@ extern const char* my_sqlite_batch_fill_path_query;
 
 #ifdef HAVE_MYSQL
 
 
 #ifdef HAVE_MYSQL
 
-#define BDB_VERSION 12
-
 #include <mysql.h>
 
 /*
 #include <mysql.h>
 
 /*
@@ -374,6 +373,7 @@ struct B_DB {
    POOLMEM *path;                     /* Path only */
    POOLMEM *esc_name;                 /* Escaped file name */
    POOLMEM *esc_path;                 /* Escaped path name */
    POOLMEM *path;                     /* Path only */
    POOLMEM *esc_name;                 /* Escaped file name */
    POOLMEM *esc_path;                 /* Escaped path name */
+   POOLMEM *esc_obj;                  /* Escaped restore object */
    int fnl;                           /* file name length */
    int pnl;                           /* path name length */
 };
    int fnl;                           /* file name length */
    int pnl;                           /* path name length */
 };
@@ -390,7 +390,7 @@ struct B_DB {
 #define sql_num_rows(x)        mysql_num_rows((x)->result)
 #define sql_data_seek(x, i)    mysql_data_seek((x)->result, (i))
 #define sql_affected_rows(x)   mysql_affected_rows((x)->db)
 #define sql_num_rows(x)        mysql_num_rows((x)->result)
 #define sql_data_seek(x, i)    mysql_data_seek((x)->result, (i))
 #define sql_affected_rows(x)   mysql_affected_rows((x)->db)
-#define sql_insert_id(x, y, z) my_mysql_sql_insert_id((x), (y), (z))
+#define sql_insert_autokey_record(x, y, z) my_mysql_insert_autokey_record((x), (y), (z))
 #define sql_field_seek(x, y)   mysql_field_seek((x)->result, (y))
 #define sql_fetch_field(x)     mysql_fetch_field((x)->result)
 #define sql_num_fields(x)      (int)mysql_num_fields((x)->result)
 #define sql_field_seek(x, y)   mysql_field_seek((x)->result, (y))
 #define sql_fetch_field(x)     mysql_fetch_field((x)->result)
 #define sql_num_fields(x)      (int)mysql_num_fields((x)->result)
@@ -414,14 +414,12 @@ extern const char* my_mysql_batch_unlock_tables_query;
 extern const char* my_mysql_batch_fill_filename_query;
 extern const char* my_mysql_batch_fill_path_query;
 extern void  my_mysql_free_result(B_DB *mdb);
 extern const char* my_mysql_batch_fill_filename_query;
 extern const char* my_mysql_batch_fill_path_query;
 extern void  my_mysql_free_result(B_DB *mdb);
-extern int my_mysql_sql_insert_id(B_DB *mdb, const char *query, const char *table_name);
+extern int my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
 
 #else
 
 #ifdef HAVE_POSTGRESQL
 
 
 #else
 
 #ifdef HAVE_POSTGRESQL
 
-#define BDB_VERSION 12
-
 #include <libpq-fe.h>
 
 /* TEMP: the following is taken from select OID, typname from pg_type; */
 #include <libpq-fe.h>
 
 /* TEMP: the following is taken from select OID, typname from pg_type; */
@@ -478,6 +476,7 @@ struct B_DB {
    POOLMEM *path;                 /* Path only */
    POOLMEM *esc_name;             /* Escaped file name */
    POOLMEM *esc_path;             /* Escaped path name */
    POOLMEM *path;                 /* Path only */
    POOLMEM *esc_name;             /* Escaped file name */
    POOLMEM *esc_path;             /* Escaped path name */
+   unsigned char *esc_obj;        /* Escaped restore object */
    int fnl;                       /* file name length */
    int pnl;                       /* path name length */
 };
    int fnl;                       /* file name length */
    int pnl;                       /* path name length */
 };
@@ -486,7 +485,7 @@ void               my_postgresql_free_result(B_DB *mdb);
 POSTGRESQL_ROW     my_postgresql_fetch_row  (B_DB *mdb);
 int                my_postgresql_query      (B_DB *mdb, const char *query);
 void               my_postgresql_data_seek  (B_DB *mdb, int row);
 POSTGRESQL_ROW     my_postgresql_fetch_row  (B_DB *mdb);
 int                my_postgresql_query      (B_DB *mdb, const char *query);
 void               my_postgresql_data_seek  (B_DB *mdb, int row);
-int                my_postgresql_insert_id  (B_DB *mdb, const char *query, const char *table_name)
+int                my_postgresql_insert_autokey_record  (B_DB *mdb, const char *query, const char *table_name);
 void               my_postgresql_field_seek (B_DB *mdb, int row);
 POSTGRESQL_FIELD * my_postgresql_fetch_field(B_DB *mdb);
 
 void               my_postgresql_field_seek (B_DB *mdb, int row);
 POSTGRESQL_FIELD * my_postgresql_fetch_field(B_DB *mdb);
 
@@ -512,7 +511,7 @@ extern const char* my_pg_batch_fill_path_query;
 #define sql_num_rows(x)       ((unsigned) PQntuples((x)->result))
 #define sql_data_seek(x, i)   my_postgresql_data_seek((x), (i))
 #define sql_affected_rows(x)  ((unsigned) atoi(PQcmdTuples((x)->result)))
 #define sql_num_rows(x)       ((unsigned) PQntuples((x)->result))
 #define sql_data_seek(x, i)   my_postgresql_data_seek((x), (i))
 #define sql_affected_rows(x)  ((unsigned) atoi(PQcmdTuples((x)->result)))
-#define sql_insert_id(x, y, z)    my_postgresql_insert_id((x), (y), (z))
+#define sql_insert_autokey_record(x, y, z)    my_postgresql_insert_autokey_record((x), (y), (z))
 #define sql_field_seek(x, y)  my_postgresql_field_seek((x), (y))
 #define sql_fetch_field(x)    my_postgresql_fetch_field(x)
 #define sql_num_fields(x)     ((x)->num_fields)
 #define sql_field_seek(x, y)  my_postgresql_field_seek((x), (y))
 #define sql_fetch_field(x)    my_postgresql_fetch_field(x)
 #define sql_num_fields(x)     ((x)->num_fields)
@@ -535,12 +534,9 @@ extern const char* my_pg_batch_fill_path_query;
 #ifdef HAVE_INGRES
 
 #include "myingres.h"
 #ifdef HAVE_INGRES
 
 #include "myingres.h"
-#include "lib/breg.h"
-
-#define BDB_VERSION 12
 
 
-/* TEMP: the following is taken from select OID, typname from pg_type; */ /*SRE: huh? */
-#define IS_NUM(x)        ((x) == 20 || (x) == 21 || (x) == 23 || (x) == 700 || (x) == 701)
+/* TEMP: the following is taken from $(II_SYSTEM)/ingres/files/eqsqlda.h IISQ_ types */
+#define IS_NUM(x)        ((x) == 10 || (x) == 30 || (x) == 31)
 #define IS_NOT_NULL(x)   ((x) == 1)
 
 typedef char **INGRES_ROW;
 #define IS_NOT_NULL(x)   ((x) == 1)
 
 typedef char **INGRES_ROW;
@@ -582,12 +578,13 @@ struct B_DB {
    uint32_t cached_path_id;
    bool allow_transactions;       /* transactions allowed */
    bool transaction;              /* transaction started */
    uint32_t cached_path_id;
    bool allow_transactions;       /* transactions allowed */
    bool transaction;              /* transaction started */
+   bool explicit_commit;          /* do an explicit commit after each query */
    int changes;                   /* changes made to db */
    POOLMEM *fname;                /* Filename only */
    POOLMEM *path;                 /* Path only */
    POOLMEM *esc_name;             /* Escaped file name */
    POOLMEM *esc_path;             /* Escaped path name */
    int changes;                   /* changes made to db */
    POOLMEM *fname;                /* Filename only */
    POOLMEM *path;                 /* Path only */
    POOLMEM *esc_name;             /* Escaped file name */
    POOLMEM *esc_path;             /* Escaped path name */
-   BREGEXP *limit_filter;         /* Filter LIMIT function in queries into supported SQL */
+   alist *query_filters;          /* Filters to convert sql queries into supported Ingres SQL */
    int fnl;                       /* file name length */
    int pnl;                       /* path name length */
 };
    int fnl;                       /* file name length */
    int pnl;                       /* path name length */
 };
@@ -599,12 +596,12 @@ void               my_ingres_data_seek  (B_DB *mdb, int row);
 void               my_ingres_field_seek (B_DB *mdb, int row);
 INGRES_FIELD *     my_ingres_fetch_field(B_DB *mdb);
 void               my_ingres_close      (B_DB *mdb);
 void               my_ingres_field_seek (B_DB *mdb, int row);
 INGRES_FIELD *     my_ingres_fetch_field(B_DB *mdb);
 void               my_ingres_close      (B_DB *mdb);
-int                my_ingres_insert_id  (B_DB *mdb, const char *query, const char *table_name);
+int                my_ingres_insert_autokey_record  (B_DB *mdb, const char *query, const char *table_name);
 
 
-int my_ingres_batch_start(JCR *jcr, B_DB *mdb);
-int my_ingres_batch_end(JCR *jcr, B_DB *mdb, const char *error);
+bool my_ingres_batch_start(JCR *jcr, B_DB *mdb);
+bool my_ingres_batch_end(JCR *jcr, B_DB *mdb, const char *error);
 typedef struct ATTR_DBR ATTR_DBR;
 typedef struct ATTR_DBR ATTR_DBR;
-int my_ingres_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
+bool my_ingres_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
 char *my_ingres_copy_escape(char *dest, char *src, size_t len);
 
 extern const char* my_ingres_batch_lock_path_query;
 char *my_ingres_copy_escape(char *dest, char *src, size_t len);
 
 extern const char* my_ingres_batch_lock_path_query;
@@ -623,7 +620,7 @@ extern const char* my_ingres_batch_fill_path_query;
 #define sql_num_rows(x)        ((unsigned) INGntuples((x)->result))
 #define sql_data_seek(x, i)    my_ingres_data_seek((x), (i))
 #define sql_affected_rows(x)   ((x)->num_rows)
 #define sql_num_rows(x)        ((unsigned) INGntuples((x)->result))
 #define sql_data_seek(x, i)    my_ingres_data_seek((x), (i))
 #define sql_affected_rows(x)   ((x)->num_rows)
-#define sql_insert_id(x, y, z) my_ingres_insert_id((x), (y), (z))
+#define sql_insert_autokey_record(x, y, z) my_ingres_insert_autokey_record((x), (y), (z))
 #define sql_field_seek(x, y)   my_ingres_field_seek((x), (y))
 #define sql_fetch_field(x)     my_ingres_fetch_field(x)
 #define sql_num_fields(x)      ((x)->num_fields)
 #define sql_field_seek(x, y)   my_ingres_field_seek((x), (y))
 #define sql_fetch_field(x)     my_ingres_fetch_field(x)
 #define sql_num_fields(x)      ((x)->num_fields)
@@ -645,8 +642,6 @@ extern const char* my_ingres_batch_fill_path_query;
 
 #ifdef HAVE_DBI
 
 
 #ifdef HAVE_DBI
 
-#define BDB_VERSION 12
-
 #include <dbi/dbi.h>
 
 #ifdef HAVE_BATCH_FILE_INSERT
 #include <dbi/dbi.h>
 
 #ifdef HAVE_BATCH_FILE_INSERT
@@ -715,6 +710,7 @@ struct B_DB {
    POOLMEM *path;                 /* Path only */
    POOLMEM *esc_name;             /* Escaped file name */
    POOLMEM *esc_path;             /* Escaped path name */
    POOLMEM *path;                 /* Path only */
    POOLMEM *esc_name;             /* Escaped file name */
    POOLMEM *esc_path;             /* Escaped path name */
+   POOLMEM *esc_obj;              /* Escaped restore object */
    int fnl;                       /* file name length */
    int pnl;                       /* path name length */
 };
    int fnl;                       /* file name length */
    int pnl;                       /* path name length */
 };
@@ -729,7 +725,7 @@ const char *       my_dbi_strerror   (B_DB *mdb);
 int                my_dbi_getisnull  (dbi_result *result, int row_number, int column_number);
 char *             my_dbi_getvalue   (dbi_result *result, int row_number, unsigned int column_number);
 //int                my_dbi_getvalue   (dbi_result *result, int row_number, unsigned int column_number, char *value);
 int                my_dbi_getisnull  (dbi_result *result, int row_number, int column_number);
 char *             my_dbi_getvalue   (dbi_result *result, int row_number, unsigned int column_number);
 //int                my_dbi_getvalue   (dbi_result *result, int row_number, unsigned int column_number, char *value);
-int                my_dbi_sql_insert_id(B_DB *mdb, const char *query, const char *table_name);
+int                my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
 
 int my_dbi_batch_start(JCR *jcr, B_DB *mdb);
 int my_dbi_batch_end(JCR *jcr, B_DB *mdb, const char *error);
 
 int my_dbi_batch_start(JCR *jcr, B_DB *mdb);
 int my_dbi_batch_end(JCR *jcr, B_DB *mdb, const char *error);
@@ -760,7 +756,7 @@ extern const char* my_dbi_match[5];
 #define SQL_MATCH             my_dbi_match[db_type]
 /* #define sql_affected_rows(x)  dbi_result_get_numrows_affected((x)->result) */
 #define sql_affected_rows(x)  1
 #define SQL_MATCH             my_dbi_match[db_type]
 /* #define sql_affected_rows(x)  dbi_result_get_numrows_affected((x)->result) */
 #define sql_affected_rows(x)  1
-#define sql_insert_id(x, y, z)  my_dbi_sql_insert_id((x), (y), (z))
+#define sql_insert_autokey_record(x, y, z)  my_dbi_insert_autokey_record((x), (y), (z))
 #define sql_field_seek(x, y)    my_dbi_field_seek((x), (y))
 #define sql_fetch_field(x)      my_dbi_fetch_field(x)
 #define sql_num_fields(x)       ((x)->num_fields)
 #define sql_field_seek(x, y)    my_dbi_field_seek((x), (y))
 #define sql_fetch_field(x)      my_dbi_fetch_field(x)
 #define sql_num_fields(x)       ((x)->num_fields)
@@ -939,6 +935,21 @@ struct ATTR_DBR {
    int DigestType;
 };
 
    int DigestType;
 };
 
+struct ROBJECT_DBR {
+   char *object_name;
+   char *object;
+   char *plugin_name;
+   uint32_t object_len;
+   uint32_t object_full_len;
+   uint32_t object_index;
+   int32_t  object_compression;
+   uint32_t FileIndex;
+   uint32_t Stream;
+   uint32_t FileType;
+   JobId_t  JobId;
+   DBId_t RestoreObjectId;
+};
+
 
 /* File record -- same format as database */
 struct FILE_DBR {
 
 /* File record -- same format as database */
 struct FILE_DBR {
@@ -1118,9 +1129,18 @@ public:
    POOLMEM *list;                     /* list */
    int count;                         /* number of values seen */
 
    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; }
    ~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 */
 private:
    db_list_ctx(const db_list_ctx&);            /* prohibit pass by value */
    db_list_ctx &operator=(const db_list_ctx&); /* prohibit class assignment */