From: Eric Bollengier Date: Wed, 7 Feb 2007 16:52:19 +0000 (+0000) Subject: ebl Add ClientId in db_create_job_record X-Git-Tag: Release-7.0.0~6925 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e0d658f2ba6596fa7d561cee8d8b5853603269ca;p=bacula%2Fbacula ebl Add ClientId in db_create_job_record It's usefull for bweb, we have always a client id with a Job git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4138 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 1734daa28b..e27d98151b 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -70,7 +70,7 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) struct tm tm; bool ok; utime_t JobTDate; - char ed1[30]; + char ed1[30],ed2[30]; db_lock(mdb); @@ -83,10 +83,11 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) /* Must create it */ Mmsg(mdb->cmd, -"INSERT INTO Job (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate) VALUES " -"('%s','%s','%c','%c','%c','%s',%s)", +"INSERT INTO Job (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate,ClientId) " +"VALUES ('%s','%s','%c','%c','%c','%s',%s,%s)", jr->Job, jr->Name, (char)(jr->JobType), (char)(jr->JobLevel), - (char)(jr->JobStatus), dt, edit_uint64(JobTDate, ed1)); + (char)(jr->JobStatus), dt, edit_uint64(JobTDate, ed1), + edit_int64(jr->ClientId, ed2)); if (!INSERT_DB(jcr, mdb, mdb->cmd)) { Mmsg2(&mdb->errmsg, _("Create DB Job record %s failed. ERR=%s\n"), diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 73658d9785..806888779b 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -156,6 +156,10 @@ bool setup_job(JCR *jcr) * Create Job record */ init_jcr_job_record(jcr); + if (!get_or_create_client_record(jcr)) { + goto bail_out; + } + if (!db_create_job_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); goto bail_out; @@ -164,10 +168,6 @@ bool setup_job(JCR *jcr) Dmsg4(100, "Created job record JobId=%d Name=%s Type=%c Level=%c\n", jcr->JobId, jcr->Job, jcr->jr.JobType, jcr->jr.JobLevel); - if (!get_or_create_client_record(jcr)) { - goto bail_out; - } - generate_daemon_event(jcr, "JobStart"); if (job_canceled(jcr)) {