]> git.sur5r.net Git - bacula/bacula/commitdiff
Restore db_type printing to dbcheck -B
authorMarco van Wieringen <mvw@planets.elm.net>
Tue, 31 May 2011 16:39:53 +0000 (18:39 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:44:37 +0000 (14:44 +0200)
bacula/src/tools/dbcheck.c

index 20a403bc9cf1a4e9db4a3fb9c80bfa76fcfc4b49..9312a4968b6c60290d4ea2bb7a373356b7fb3416 100644 (file)
@@ -75,6 +75,7 @@ static CONFIG *config;
 #define MAX_ID_LIST_LEN 10000000
 
 /* Forward referenced functions */
+static void print_catalog_details(CAT *catalog, const char *working_dir);
 static int make_id_list(const char *query, ID_LIST *id_list);
 static int delete_id_list(const char *query, ID_LIST *id_list);
 static int make_name_list(const char *query, NAME_LIST *name_list);
@@ -232,10 +233,7 @@ int main (int argc, char *argv[])
 
          /* Print catalog information and exit (-B) */
          if (print_catalog) {
-            POOLMEM *buf = get_pool_memory(PM_MESSAGE);
-            printf("%s\nworking_dir=%s\n", catalog->display(buf),
-                    working_directory);
-            free_pool_memory(buf);
+            print_catalog_details(catalog, director->working_directory);
             exit(0);
          }
 
@@ -336,6 +334,26 @@ int main (int argc, char *argv[])
    return 0;
 }
 
+static void print_catalog_details(CAT *catalog, const char *working_dir)
+{
+   POOLMEM *buf = get_pool_memory(PM_MESSAGE);
+
+   /*
+    * Instantiate a B_DB class and see what db_type gets assigned to it.
+    */
+   db = db_init_database(NULL, catalog->db_driver, catalog->db_name, catalog->db_user,
+                         catalog->db_password, catalog->db_address,
+                         catalog->db_port, catalog->db_socket,
+                         catalog->mult_db_connections,
+                         catalog->disable_batch_insert);
+   if (db) {
+      printf("%sdb_type=%s\nworking_dir=%s\n", catalog->display(buf),
+             db->db_get_type(), working_directory);
+      db_close_database(NULL, db);
+   }
+   free_pool_memory(buf);
+}
+
 static void do_interactive_mode()
 {
    const char *cmd;