{
bool multi_db;
- if (mdb->batch_insert_available())
- multi_db = true; /* we force a new connection only if batch insert is enabled */
- else
- multi_db = false;
+ multi_db = mdb->batch_insert_available();
if (!jcr->db_batch) {
jcr->db_batch = db_clone_database_connection(mdb, jcr, multi_db);
if (!jcr->db_batch) {
- Mmsg0(&mdb->errmsg, _("Could not init database batch connection"));
+ Mmsg0(&mdb->errmsg, _("Could not init database batch connection\n"));
Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
return false;
}
int stat;
int num_rows;
+ mdb->errmsg[0] = 0;
mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->pnl+2);
db_escape_string(jcr, mdb, mdb->esc_name, mdb->path, mdb->pnl);
SQL_ROW row;
int num_rows;
+ mdb->errmsg[0] = 0;
mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->fnl+2);
db_escape_string(jcr, mdb, mdb->esc_name, mdb->fname, mdb->fnl);
{
bool ret;
+ mdb->errmsg[0] = 0;
/*
* Make sure we have an acceptable attributes record.
*/
if (!(ar->Stream == STREAM_UNIX_ATTRIBUTES ||
ar->Stream == STREAM_UNIX_ATTRIBUTES_EX)) {
- Jmsg(jcr, M_FATAL, 0, _("Attempt to put non-attributes into catalog. Stream=%d\n"));
+ Mmsg1(&mdb->errmsg, _("Attempt to put non-attributes into catalog. Stream=%d\n"),
+ ar->Stream);
+ Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
return false;
}
if (ar->FileType != FT_BASE) {
if (mdb->batch_insert_available()) {
ret = db_create_batch_file_attributes_record(jcr, mdb, ar);
+ /* Error message already printed */
} else {
ret = db_create_file_attributes_record(jcr, mdb, ar);
}
} else if (jcr->HasBase) {
ret = db_create_base_file_attributes_record(jcr, mdb, ar);
} else {
- Jmsg0(jcr, M_FATAL, 0, _("Cannot Copy/Migrate job using BaseJob"));
+ Mmsg0(&mdb->errmsg, _("Cannot Copy/Migrate job using BaseJob.\n"));
+ Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
ret = true; /* in copy/migration what do we do ? */
}
bool db_sql_query(B_DB *mdb, const char *query, int flags)
{
+ mdb->errmsg[0] = 0;
return mdb->db_sql_query(query, flags);
}
bool db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
{
+ mdb->errmsg[0] = 0;
return mdb->db_sql_query(query, result_handler, ctx);
}
bool db_big_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
{
+ mdb->errmsg[0] = 0;
return mdb->db_big_sql_query(query, result_handler, ctx);
}
bool sql_query(B_DB *mdb, const char *query, int flags)
{
+ mdb->errmsg[0] = 0;
return ((B_DB_PRIV *)mdb)->sql_query(query, flags);
}
if (jcr->cached_attribute) {
Dmsg2(400, "Cached attr. Stream=%d fname=%s\n", ar->Stream, ar->fname);
if (!db_create_attributes_record(jcr, jcr->db, ar)) {
- Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db));
+ Jmsg1(jcr, M_FATAL, 0, _("Attribute create error: ERR=%s"), db_strerror(jcr->db));
}
jcr->cached_attribute = false;
}