From 9e99a05f566f265929dbc78d84b68912baceda4c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 23 Dec 2008 14:13:27 +0000 Subject: [PATCH] Fix bug #1206 -- Error: sql_update.c:194, which was probably caused by the user modifying the Bacula DB schema. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8237 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/sql_update.c | 25 +++++-------------------- bacula/technotes-2.5 | 2 ++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index d567fbff0f..535dbd1173 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -147,15 +147,6 @@ db_update_stats(JCR *jcr, B_DB *mdb, utime_t age) return sql_affected_rows(mdb); } -/* - * Given an incoming integer, set the string buffer to either NULL or the value - * - */ -static void edit_num_or_null(char *s, size_t n, uint64_t id) { - char ed1[50]; - bsnprintf(s, n, id ? "%s" : "NULL", edit_int64(id, ed1)); -} - /* * Update the Job record at end of Job * @@ -172,13 +163,7 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) int stat; char ed1[30], ed2[30], ed3[50]; btime_t JobTDate; - char PoolId[50], FileSetId[50], ClientId[50], PriorJobId[50]; - - - /* some values are set to zero, which translates to NULL in SQL */ - edit_num_or_null(PoolId, sizeof(PoolId), jr->PoolId); - edit_num_or_null(FileSetId, sizeof(FileSetId), jr->FileSetId); - edit_num_or_null(ClientId, sizeof(ClientId), jr->ClientId); + char PriorJobId[50]; if (jr->PriorJobId) { bstrncpy(PriorJobId, edit_int64(jr->PriorJobId, ed1), sizeof(PriorJobId)); @@ -202,12 +187,12 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) db_lock(mdb); Mmsg(mdb->cmd, "UPDATE Job SET JobStatus='%c',EndTime='%s'," -"ClientId=%s,JobBytes=%s,JobFiles=%u,JobErrors=%u,VolSessionId=%u," -"VolSessionTime=%u,PoolId=%s,FileSetId=%s,JobTDate=%s," +"ClientId=%u,JobBytes=%s,JobFiles=%u,JobErrors=%u,VolSessionId=%u," +"VolSessionTime=%u,PoolId=%u,FileSetId=%u,JobTDate=%s," "RealEndTime='%s',PriorJobId=%s WHERE JobId=%s", - (char)(jr->JobStatus), dt, ClientId, edit_uint64(jr->JobBytes, ed1), + (char)(jr->JobStatus), dt, jr->ClientId, edit_uint64(jr->JobBytes, ed1), jr->JobFiles, jr->JobErrors, jr->VolSessionId, jr->VolSessionTime, - PoolId, FileSetId, edit_uint64(JobTDate, ed2), + jr->PoolId, jr->FileSetId, edit_uint64(JobTDate, ed2), rdt, PriorJobId, edit_int64(jr->JobId, ed3)); diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 5b64921f64..c06cd5f2ad 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -11,6 +11,8 @@ mixed priorities General: 23Dec08 +kes Fix bug #1206 -- Error: sql_update.c:194, which was probably + caused by the user modifying the Bacula DB schema. kes Remove rogue line of C code. kes Fix bug #1208 20Dec08 -- 2.39.5