bool do_a_command(UAContext *ua);
bool do_a_dot_command(UAContext *ua);
int qmessagescmd(UAContext *ua, const char *cmd);
+bool open_new_client_db(UAContext *ua);
bool open_client_db(UAContext *ua);
bool open_db(UAContext *ua);
void close_db(UAContext *ua);
int max_prompts; /* max size of list */
int num_prompts; /* current number in list */
int api; /* For programs want an API */
+ bool force_mult_db_connections; /* overwrite cat.mult_db_connections */
bool auto_display_messages; /* if set, display messages */
bool user_notified_msg_pending; /* set when user notified */
bool automount; /* if set, mount after label */
}
#endif
+/*
+ * This call uses open_client_db() and force a
+ * new dedicated connection to the catalog
+ */
+bool open_new_client_db(UAContext *ua)
+{
+ bool ret;
+
+ /* Force a new dedicated connection */
+ close_db(ua);
+ ua->force_mult_db_connections = true;
+ ret = open_client_db(ua);
+ ua->force_mult_db_connections = false;
+ return ret;
+}
+
/*
* This call explicitly checks for a catalog=xxx and
* if given, opens that catalog. It also checks for
*/
bool open_db(UAContext *ua)
{
+ bool mult_db_conn;
+
if (ua->db) {
return true;
}
}
}
+ /* Some modules like bvfs need their own catalog connection */
+ mult_db_conn = ua->catalog->mult_db_connections;
+ if (ua->force_mult_db_connections) {
+ mult_db_conn = true;
+ }
+
ua->jcr->catalog = ua->catalog;
Dmsg0(100, "UA Open database\n");
ua->catalog->db_user,
ua->catalog->db_password, ua->catalog->db_address,
ua->catalog->db_port, ua->catalog->db_socket,
- ua->catalog->mult_db_connections);
+ mult_db_conn);
if (!ua->db || !db_open_database(ua->jcr, ua->db)) {
ua->error_msg(_("Could not open catalog database \"%s\".\n"),
ua->catalog->db_name);
static bool dot_bvfs_update(UAContext *ua, const char *cmd)
{
-
- if (!open_client_db(ua)) {
+ if (!open_new_client_db(ua)) {
return 1;
}
/* update cache for all jobids */
bvfs_update_cache(ua->jcr, ua->db);
}
+
+ close_db(ua);
return true;
}