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
|
configure.ac
|
||||||
version.h
|
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
|
// delete record
|
||||||
//
|
//
|
||||||
int DB_BASE::delete_from_db() {
|
int DB_BASE::delete_from_db() {
|
||||||
char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN];
|
char query[MAX_QUERY_LEN];
|
||||||
db_print(vals);
|
|
||||||
sprintf(query, "delete from %s where id=%u", table_name, get_id());
|
sprintf(query, "delete from %s where id=%u", table_name, get_id());
|
||||||
return db->do_query(query);
|
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) {
|
int DB_BASE::get_field_ints(const char* fields, int nfields, int* vals) {
|
||||||
char query[MAX_QUERY_LEN];
|
char query[MAX_QUERY_LEN];
|
||||||
int retval;
|
int retval;
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
int update_field(const char*, const char* where_clause=NULL);
|
int update_field(const char*, const char* where_clause=NULL);
|
||||||
int update_fields_noid(char* set_clause, char* where_clause);
|
int update_fields_noid(char* set_clause, char* where_clause);
|
||||||
int delete_from_db();
|
int delete_from_db();
|
||||||
|
int delete_from_db_multi(const char* where_clause);
|
||||||
int get_field_ints(const char*, int, int*);
|
int get_field_ints(const char*, int, int*);
|
||||||
int get_field_str(const char*, char*, int);
|
int get_field_str(const char*, char*, int);
|
||||||
int lookup_id(int id);
|
int lookup_id(int id);
|
||||||
|
|
|
@ -549,6 +549,13 @@ bool do_pass() {
|
||||||
"Purged workunit [%d] from database\n", wu.id
|
"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++;
|
purged_workunits++;
|
||||||
do_pass_purged_workunits++;
|
do_pass_purged_workunits++;
|
||||||
wu_stored_in_file++;
|
wu_stored_in_file++;
|
||||||
|
|
Loading…
Reference in New Issue