utime_t now = (utime_t)time(NULL);
edit_uint64(now - age, ed1);
- Mmsg(mdb->cmd,
- "INSERT INTO JobHistory "
- "SELECT * "
- "FROM Job "
- "WHERE JobStatus IN ('T', 'f', 'A', 'E') "
- "AND JobId NOT IN (SELECT JobId FROM JobHistory) "
- "AND JobTDate < %s ", ed1);
+ Mmsg(mdb->cmd, fill_jobhisto, ed1);
QUERY_DB(jcr, mdb, mdb->cmd); /* TODO: get a message ? */
return sql_affected_rows(mdb);
}
time_t ttime;
struct tm tm;
int stat;
- char ed1[30], ed2[30], ed3[50];
+ char ed1[30], ed2[30], ed3[50], ed4[50];
btime_t JobTDate;
char PriorJobId[50];
db_lock(mdb);
Mmsg(mdb->cmd,
"UPDATE Job SET JobStatus='%c',EndTime='%s',"
-"ClientId=%u,JobBytes=%s,JobFiles=%u,JobErrors=%u,VolSessionId=%u,"
+"ClientId=%u,JobBytes=%s,ReadBytes=%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, jr->ClientId, edit_uint64(jr->JobBytes, ed1),
+ edit_uint64(jr->ReadBytes, ed4),
jr->JobFiles, jr->JobErrors, jr->VolSessionId, jr->VolSessionTime,
jr->PoolId, jr->FileSetId, edit_uint64(JobTDate, ed2),
rdt,