sr->StorageId = 0;
sr->created = false;
+ /* Check if it already exists */
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
mdb->num_rows = sql_num_rows(mdb);
/* If more than one, report error, but return first row */
}
bstrncpy(sr.Name, store->name(), sizeof(sr.Name));
sr.AutoChanger = store->autochanger;
- db_create_storage_record(NULL, db, &sr);
+ if (!db_create_storage_record(NULL, db, &sr)) {
+ Jmsg(NULL, M_FATAL, 0, _("Could not create storage record for %s\n"),
+ store->name());
+ OK = false;
+ }
store->StorageId = sr.StorageId; /* set storage Id */
if (!sr.created) { /* if not created, update it */
sr.AutoChanger = store->autochanger;
- db_update_storage_record(NULL, db, &sr);
+ if (!db_update_storage_record(NULL, db, &sr)) {
+ Jmsg(NULL, M_FATAL, 0, _("Could not update storage record for %s\n"),
+ store->name());
+ OK = false;
+ }
}
/* tls_require implies tls_enable */