/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*
* Kern Sibbald, March 2000
*
- * Version $Id: sql_update.c 8478 2009-02-18 20:11:55Z kerns $
*/
#include "bacula.h"
db_update_stats(JCR *jcr, B_DB *mdb, utime_t age)
{
char ed1[30];
+ int rows;
utime_t now = (utime_t)time(NULL);
edit_uint64(now - age, ed1);
+ db_lock(mdb);
+
Mmsg(mdb->cmd, fill_jobhisto, ed1);
QUERY_DB(jcr, mdb, mdb->cmd); /* TODO: get a message ? */
- return sql_affected_rows(mdb);
+ rows = sql_affected_rows(mdb);
+
+ db_unlock(mdb);
+
+ return rows;
}
/*
db_lock(mdb);
mdb->db_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
Mmsg(mdb->cmd,
-"UPDATE Counters SET \"MinValue\"=%d,\"MaxValue\"=%d,CurrentValue=%d,"
+"UPDATE Counters SET Counters.MinValue=%d,Counters.MaxValue=%d,CurrentValue=%d,"
"WrapCounter='%s' WHERE Counter='%s'",
cr->MinValue, cr->MaxValue, cr->CurrentValue,
cr->WrapCounter, esc);