char *p = path;
int len = strlen(path) - 1;
+ /* windows directory / */
+ if (len == 2 && B_ISALPHA(path[0])
+ && path[1] == ':'
+ && path[2] == '/')
+ {
+ len = 0;
+ path[0] = '\0';
+ }
+
if (len >= 0 && path[len] == '/') { /* if directory, skip last / */
path[len] = '\0';
}
db_list_ctx jobids_list;
db_lock(mdb);
- db_start_transaction(jcr, mdb);
#ifdef xxx
/* TODO: Remove this code when updating make_bacula_table script */
bvfs_update_path_hierarchy_cache(jcr, mdb, jobids_list.list);
- db_end_transaction(jcr, mdb);
db_start_transaction(jcr, mdb);
Dmsg0(dbglevel, "Cleaning pathvisibility\n");
Mmsg(mdb->cmd,
return false;
}
+void Bvfs::clear_cache()
+{
+ db_sql_query(db, "BEGIN", NULL, NULL);
+ db_sql_query(db, "UPDATE Job SET HasCache=0", NULL, NULL);
+ db_sql_query(db, "TRUNCATE PathHierarchy", NULL, NULL);
+ db_sql_query(db, "TRUNCATE PathVisibility", NULL, NULL);
+ db_sql_query(db, "COMMIT", NULL, NULL);
+}
+
bool Bvfs::drop_restore_list(char *output_table)
{
POOL_MEM query;
/* MySQL need it */
if (db_get_type_index(db) == SQL_TYPE_MYSQL) {
- Mmsg(query, "CREATE INDEX idx_%s ON b2%s (JobId)",
+ Mmsg(query, "CREATE INDEX idx_%s ON %s (JobId)",
output_table, output_table);
Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
if (!db_sql_query(db, query.c_str(), NULL, NULL)) {