From 7c201eba3f2f59f86933c82af6e28bc896982427 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 9 Nov 2011 07:41:49 +0000 Subject: [PATCH] - DB: use %u when writing result IDs in SQL queries; this is to support SETI@home, which ran out of result IDs and changed the DB field type to int unsigned. Note: eventually I'll make this change official and change the .h types as well. - web: put tags around elements in project-specific prefs. svn path=/trunk/boinc/; revision=24555 --- checkin_notes | 17 +++++++++++++++++ db/boinc_db.cpp | 6 +++--- db/db_base.cpp | 14 +++++++------- html/project.sample/project_specific_prefs.inc | 6 ++++-- sched/sched_send.cpp | 2 ++ 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index b5acbce976..d66fb28f94 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8252,3 +8252,20 @@ Rom 8 Nov 2011 api/ boinc_opencl.cpp + +David 8 Nov 2011 + - DB: use %u when writing result IDs in SQL queries; + this is to support SETI@home, which ran out of result IDs + and changed the DB field type to int unsigned. + Note: eventually I'll make this change official + and change the .h types as well. + - web: put tags around elements + in project-specific prefs. + + db/ + boinc_db.cpp + db_base.cpp + sched/ + sched_send.cpp + html/project.sample/ + project_specific_prefs.inc diff --git a/db/boinc_db.cpp b/db/boinc_db.cpp index 6fb8561738..092cd853a8 100644 --- a/db/boinc_db.cpp +++ b/db/boinc_db.cpp @@ -789,7 +789,7 @@ void DB_WORKUNIT::db_print(char* buf){ "rsc_fpops_est=%.15e, rsc_fpops_bound=%.15e, " "rsc_memory_bound=%.15e, rsc_disk_bound=%.15e, " "need_validate=%d, " - "canonical_resultid=%d, canonical_credit=%.15e, " + "canonical_resultid=%u, canonical_credit=%.15e, " "transition_time=%d, delay_bound=%d, " "error_mask=%d, file_delete_state=%d, assimilate_state=%d, " "hr_class=%d, opaque=%.15e, " @@ -1055,7 +1055,7 @@ void DB_ASSIGNMENT::db_print(char* buf) { "target_type=%d, " "multi=%d, " "workunitid=%d, " - "resultid=%d", + "resultid=%u", create_time, target_id, target_type, @@ -1648,7 +1648,7 @@ int DB_VALIDATOR_ITEM_SET::update_workunit(WORKUNIT& wu) { "update workunit set need_validate=0, error_mask=%d, " "assimilate_state=%d, transition_time=%d, " "target_nresults=%d, " - "canonical_resultid=%d, canonical_credit=%.15e " + "canonical_resultid=%u, canonical_credit=%.15e " "where id=%d", wu.error_mask, wu.assimilate_state, diff --git a/db/db_base.cpp b/db/db_base.cpp index a03aac4e1d..63ef6fff0f 100644 --- a/db/db_base.cpp +++ b/db/db_base.cpp @@ -207,7 +207,7 @@ int DB_BASE::lookup_id(int id) { MYSQL_ROW row; MYSQL_RES* rp; - sprintf(query, "select * from %s where id=%d", table_name, id); + sprintf(query, "select * from %s where id=%u", table_name, id); retval = db->do_query(query); if (retval) return retval; @@ -227,7 +227,7 @@ int DB_BASE::lookup_id(int id) { int DB_BASE::update() { char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN]; db_print(vals); - sprintf(query, "update %s set %s where id=%d", table_name, vals, get_id()); + sprintf(query, "update %s set %s where id=%u", table_name, vals, get_id()); int retval = db->do_query(query); if (retval) return retval; if (db->affected_rows() != 1) return ERR_DB_NOT_FOUND; @@ -240,9 +240,9 @@ int DB_BASE::update() { int DB_BASE::update_field(const char* clause, const char* where_clause) { char query[MAX_QUERY_LEN]; if (where_clause) { - sprintf(query, "update %s set %s where id=%d and %s", table_name, clause, get_id(), where_clause); + sprintf(query, "update %s set %s where id=%u and %s", table_name, clause, get_id(), where_clause); } else { - sprintf(query, "update %s set %s where id=%d", table_name, clause, get_id()); + sprintf(query, "update %s set %s where id=%u", table_name, clause, get_id()); } return db->do_query(query); } @@ -252,7 +252,7 @@ int DB_BASE::update_field(const char* clause, const char* where_clause) { int DB_BASE::delete_from_db() { char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN]; db_print(vals); - sprintf(query, "delete from %s where id=%d", table_name, get_id()); + sprintf(query, "delete from %s where id=%u", table_name, get_id()); return db->do_query(query); } @@ -263,7 +263,7 @@ int DB_BASE::get_field_ints(const char* fields, int nfields, int* vals) { MYSQL_RES* rp; sprintf(query, - "select %s from %s where id=%d", fields, table_name, get_id() + "select %s from %s where id=%u", fields, table_name, get_id() ); retval = db->do_query(query); if (retval) return retval; @@ -287,7 +287,7 @@ int DB_BASE::get_field_str(const char* field, char* buf, int buflen) { MYSQL_RES* rp; sprintf(query, - "select %s from %s where id=%d", field, table_name, get_id() + "select %s from %s where id=%u", field, table_name, get_id() ); retval = db->do_query(query); if (retval) return retval; diff --git a/html/project.sample/project_specific_prefs.inc b/html/project.sample/project_specific_prefs.inc index a19d82d286..1f4b491406 100644 --- a/html/project.sample/project_specific_prefs.inc +++ b/html/project.sample/project_specific_prefs.inc @@ -49,7 +49,7 @@ define("MAX_GFX_CPU_PCT_DESC", tra("Maximum CPU % for graphics%10 ... 100%2", "< define('APP_SELECT_DESC', tra('Run only the selected applications')); define('ACCEPT_ANY_DESC', tra('If no work for selected applications is available, accept work from other applications?')); -// The following array is for app filtering; uncomment if you want it. +// stuff related to app filtering. // Note: in this implementation, if a user selects all apps, // no elements are included in their prefs, // which means that if the project adds a new app such users will run it also. @@ -143,7 +143,7 @@ function project_specific_prefs_parse_form(&$error) { } if (APP_SELECT_PREFS) { - $y = ""; + $y = "\n"; $some_unchecked = false; foreach ($app_array as $app) { $app_id = $app[0]; @@ -154,6 +154,8 @@ function project_specific_prefs_parse_form(&$error) { $some_unchecked = true; } } + $y .= "\n"; + if ($some_unchecked) { $x .= $y; } diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index 4271cf1329..02ca71ec7a 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -267,6 +267,8 @@ double estimate_duration(WORKUNIT& wu, BEST_APP_VERSION& bav) { return ed; } +// TODO: use XML_PARSER +// static void get_prefs_info() { char buf[8096]; std::string str;