$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L../cats -L. -L../lib -L../findlib -o $@ ing_test.o \
-lbacsql -lbaccats -lbacfind -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-cats_test.o: cats_test.o
+cats_test.o: cats_test.c
echo "Compiling $<"
$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) $(SQL_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
cats_test: Makefile ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) cats_test.o
$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L../cats -L. -L../lib -L../findlib -o $@ cats_test.o \
- -lbacsql -lbacfind -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
+ -lbacsql -lbaccats -lbacfind -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
gigaslam.o: gigaslam.c
$(CXX) $(CFLAGS) -c $<
" 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 use_batch = true;
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':
+ use_batch = false;
+ break;
+ case 'b':
+ use_batch = true;
+ break;
case 'd': /* debug level */
if (*optarg == 't') {
dbg_timestamp = true;
/* To use the -r option, the catalog should already contains records */
if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
- db_host, 0, NULL, false, false)) == NULL) {
+ db_host, 0, NULL, false, use_batch)) == NULL) {
Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
}
if (!db_open_database(NULL, db)) {
return 0;
}
-#ifdef HAVE_BATCH_FILE_INSERT
- printf("With new Batch mode\n");
-#else
- printf("Without new Batch mode\n");
-#endif
+ if (use_batch) {
+ printf("With new Batch mode\n");
+ } else {
+ printf("Without new Batch mode\n");
+ }
+
i = nb;
while (--i >= 0) {
pthread_t thid;
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"));
}
}
*
*
*/
-#define __SQL_C
-#define BUILDING_CATS
+#define _BDB_PRIV_INTERFACE_
#include "bacula.h"
#include "cats/cats.h"
+#include "cats/bdb_priv.h"
+#include "cats/sql_glue.h"
#include "cats/bvfs.h"
#include "findlib/find.h"
{
uint32_t *k = (uint32_t*) ctx;
(*k)++;
+ ok(nb_col > 4, "Check result columns");
ok(!strcmp(row[0], aPATH aPATH aPATH aPATH "/"), "Check path");
ok(!strcmp(row[1], aFILE aFILE ".txt"), "Check filename");
ok(str_to_int64(row[2]) == 10, "Check FileIndex");
Pmsg1(0, PLINE "Test DB connection \"%s\"" PLINE, db_name);
if (full_test) {
- db = db_init(jcr /* JCR */,
+ db = db_init_database(jcr /* JCR */,
NULL /* dbi driver */,
db_name, db_user, db_password, db_address, db_port + 100,
NULL /* db_socket */,
- 0 /* mult_db_connections */);
+ 0 /* mult_db_connections */, false);
ok(db != NULL, "Test bad connection");
if (!db) {
report();
db_close_database(jcr, db);
}
- db = db_init(jcr /* JCR */,
+ db = db_init_database(jcr /* JCR */,
NULL /* dbi driver */,
db_name, db_user, db_password, db_address, db_port,
NULL /* db_socket */,
- 0 /* mult_db_connections */);
+ false /* mult_db_connections */, false);
ok(db != NULL, "Test db connection");
if (!db) {
report();
exit (1);
}
- dbtype = db_type;
+ dbtype = db_get_type_index(db);
+
/* Check if the SQL library is thread-safe */
- db_check_backend_thread_safe();
+ //db_check_backend_thread_safe();
ok(check_tables_version(jcr, db), "Check table version");
ok(db_sql_query(db, "SELECT VersionId FROM Version",
db_int_handler, &j), "SELECT VersionId");
ar.FileType = FT_REG;
jcr->JobId = ar.JobId = jr.JobId;
jcr->JobStatus = JS_Running;
- ok(db_create_file_attributes_record(jcr, db, &ar), "Inserting Filename");
+ ok(db_create_attributes_record(jcr, db, &ar), "Inserting Filename");
ok(db_write_batch_file_records(jcr), "Commit batch session");
Mmsg(buf, "SELECT FileIndex FROM File WHERE JobId=%lld",(int64_t)jcr->JobId);
ok(db_sql_query(db, buf, db_int_handler, &j), "Get Inserted record");