#include "stored/stored.h"
#include "findlib/find.h"
#include "cats/cats.h"
+#include "cats/sql_glue.h"
/* Forward referenced functions */
static void *do_batch(void *);
" will start 3 thread and load dat1, dat and datx in your catalog\n"
"See bbatch.c to generate datafile\n\n"
"Usage: bbatch [ options ] -w working/dir -f datafile\n"
+" -b with batch mode\n"
+" -B without batch mode\n"
" -d <nn> set debug level to <nn>\n"
" -dt print timestamp in debug output\n"
" -n <name> specify the database name (default bacula)\n"
int main (int argc, char *argv[])
{
int ch;
+ bool disable_batch = false;
char *restore_list=NULL;
setlocale(LC_ALL, "");
bindtextdomain("bacula", LOCALEDIR);
OSDependentInit();
- while ((ch = getopt(argc, argv, "h:c:d:n:P:Su:vf:w:r:?")) != -1) {
+ while ((ch = getopt(argc, argv, "bBh:c:d:n:P:Su:vf:w:r:?")) != -1) {
switch (ch) {
case 'r':
restore_list=bstrdup(optarg);
break;
-
+ case 'B':
+ disable_batch = true;
+ break;
+ case 'b':
+ disable_batch = false;
+ break;
case 'd': /* debug level */
if (*optarg == 't') {
dbg_timestamp = true;
btime_t start, end;
/* To use the -r option, the catalog should already contains records */
- if ((db=db_init(NULL, NULL, db_name, db_user, db_password,
- db_host, 0, NULL, 0)) == NULL) {
+ if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
+ db_host, 0, NULL, false, disable_batch)) == NULL) {
Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
}
if (!db_open_database(NULL, db)) {
}
start = get_current_btime();
- db_get_file_list(NULL, db, restore_list, false, list_handler, &nb_file);
+ db_get_file_list(NULL, db, restore_list, false, false, list_handler, &nb_file);
end = get_current_btime();
Pmsg3(0, _("Computing file list for jobid=%s files=%lld secs=%d\n"),
return 0;
}
-#ifdef HAVE_BATCH_FILE_INSERT
- printf("With new Batch mode\n");
-#else
- printf("Without new Batch mode\n");
-#endif
+ if (disable_batch) {
+ printf("Without new Batch mode\n");
+ } else {
+ printf("With new Batch mode\n");
+ }
+
i = nb;
while (--i >= 0) {
pthread_t thid;
bjcr->NumReadVolumes = 0;
bjcr->NumWriteVolumes = 0;
bjcr->JobId = getpid();
- bjcr->set_JobType(JT_CONSOLE);
- bjcr->set_JobLevel(L_FULL);
+ bjcr->setJobType(JT_CONSOLE);
+ bjcr->setJobLevel(L_FULL);
bjcr->JobStatus = JS_Running;
bjcr->where = bstrdup(files[i]);
bjcr->job_name = get_pool_memory(PM_FNAME);
bjcr->fileset_md5 = get_pool_memory(PM_FNAME);
pm_strcpy(bjcr->fileset_md5, "Dummy.fileset.md5");
- if ((db=db_init(NULL, NULL, db_name, db_user, db_password,
- db_host, 0, NULL, 0)) == NULL) {
+ if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
+ db_host, 0, NULL, false, false)) == NULL) {
Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
}
if (!db_open_database(NULL, db)) {
printf("\r%i", lineno);
}
fill_attr(&ar, data);
- if (!db_create_file_attributes_record(bjcr, bjcr->db, &ar)) {
+ if (!db_create_attributes_record(bjcr, bjcr->db, &ar)) {
Emsg0(M_ERROR_TERM, 0, _("Error while inserting file\n"));
}
}