mirror of https://github.com/BOINC/boinc.git
- db_purge: when deleting a workunit record,
delete any assignments that refer to it svn path=/trunk/boinc/; revision=25284
This commit is contained in:
parent
3431257465
commit
24d386e511
|
@ -1830,3 +1830,12 @@ Rom 17 Feb 2012
|
|||
/
|
||||
configure.ac
|
||||
version.h
|
||||
|
||||
David 17 Feb 2012
|
||||
- db_purge: when deleting a workunit record,
|
||||
delete any assignments that refer to it
|
||||
|
||||
db/
|
||||
db_base.cpp,h
|
||||
sched/
|
||||
db_purge.cpp
|
||||
|
|
|
@ -250,12 +250,17 @@ int DB_BASE::update_field(const char* clause, const char* where_clause) {
|
|||
// delete record
|
||||
//
|
||||
int DB_BASE::delete_from_db() {
|
||||
char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN];
|
||||
db_print(vals);
|
||||
char query[MAX_QUERY_LEN];
|
||||
sprintf(query, "delete from %s where id=%u", table_name, get_id());
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
int DB_BASE::delete_from_db_multi(const char* where_clause) {
|
||||
char query[MAX_QUERY_LEN];
|
||||
sprintf(query, "delete from %s where %s", table_name, where_clause);
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
int DB_BASE::get_field_ints(const char* fields, int nfields, int* vals) {
|
||||
char query[MAX_QUERY_LEN];
|
||||
int retval;
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
int update_field(const char*, const char* where_clause=NULL);
|
||||
int update_fields_noid(char* set_clause, char* where_clause);
|
||||
int delete_from_db();
|
||||
int delete_from_db_multi(const char* where_clause);
|
||||
int get_field_ints(const char*, int, int*);
|
||||
int get_field_str(const char*, char*, int);
|
||||
int lookup_id(int id);
|
||||
|
|
|
@ -549,6 +549,13 @@ bool do_pass() {
|
|||
"Purged workunit [%d] from database\n", wu.id
|
||||
);
|
||||
|
||||
if (config.enable_assignment) {
|
||||
DB_ASSIGNMENT asg;
|
||||
char buf[256];
|
||||
sprintf(buf, "workunitid=%d", wu.id);
|
||||
asg.delete_from_db_multi(buf);
|
||||
}
|
||||
|
||||
purged_workunits++;
|
||||
do_pass_purged_workunits++;
|
||||
wu_stored_in_file++;
|
||||
|
|
Loading…
Reference in New Issue