diff --git a/db/boinc_db.cpp b/db/boinc_db.cpp index 43c3a871f2..5380a81776 100644 --- a/db/boinc_db.cpp +++ b/db/boinc_db.cpp @@ -470,6 +470,7 @@ void DB_HOST::db_print(char* buf){ ESCAPE(p_model); ESCAPE(os_name); ESCAPE(os_version); + ESCAPE(product_name); sprintf(buf, "create_time=%d, userid=%d, " "rpc_seqno=%d, rpc_time=%d, " @@ -490,7 +491,8 @@ void DB_HOST::db_print(char* buf){ "venue='%s', nresults_today=%d, " "avg_turnaround=%.15e, " "host_cpid='%s', external_ip_addr='%s', max_results_day=%d, " - "error_rate=%.15e ", + "error_rate=%.15e, " + "product_name='%s' ", create_time, userid, rpc_seqno, rpc_time, total_credit, expavg_credit, expavg_time, @@ -509,7 +511,8 @@ void DB_HOST::db_print(char* buf){ venue, nresults_today, avg_turnaround, host_cpid, external_ip_addr, _max_results_day, - _error_rate + _error_rate, + product_name ); UNESCAPE(domain_name); UNESCAPE(serialnum); @@ -519,6 +522,7 @@ void DB_HOST::db_print(char* buf){ UNESCAPE(os_name); UNESCAPE(os_version); UNESCAPE(host_cpid); + UNESCAPE(product_name); } void DB_HOST::db_parse(MYSQL_ROW &r) { @@ -568,6 +572,7 @@ void DB_HOST::db_parse(MYSQL_ROW &r) { strcpy2(external_ip_addr, r[i++]); _max_results_day = atoi(r[i++]); _error_rate = atof(r[i++]); + strcpy2(product_name, r[i++]); } int DB_HOST::update_diff_validator(HOST& h) { @@ -783,6 +788,12 @@ int DB_HOST::update_diff_sched(HOST& h) { strcat(updates, buf); } #endif + if (strcmp(product_name, h.product_name)) { + escape_string(product_name, sizeof(product_name)); + sprintf(buf, " product_name='%s',", product_name); + unescape_string(product_name, sizeof(product_name)); + strcat(updates, buf); + } int n = strlen(updates); if (n == 0) return 0; diff --git a/db/boinc_db_types.h b/db/boinc_db_types.h index 212f698784..d953829c9b 100644 --- a/db/boinc_db_types.h +++ b/db/boinc_db_types.h @@ -333,6 +333,7 @@ struct HOST { // dynamic estimate of fraction of results // that fail validation // DEPRECATED + char product_name[256]; // the following not in DB char p_features[1024]; diff --git a/db/schema.sql b/db/schema.sql index f180134042..28acae53f1 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -185,6 +185,7 @@ create table host ( external_ip_addr varchar(254), max_results_day integer not null, error_rate double not null default 0, + product_name varchar(254) not null, primary key (id) ) engine=InnoDB; diff --git a/html/ops/db_update.php b/html/ops/db_update.php index 8f6efae627..8bd97300a0 100644 --- a/html/ops/db_update.php +++ b/html/ops/db_update.php @@ -849,6 +849,10 @@ function update_4_26_2013() { do_query("alter table result add size_class smallint not null default -1"); } +function update_5_23_2013() { + do_query("alter table host add product_name varchar(254) not null"); +} + // Updates are done automatically if you use "upgrade". // // If you need to do updates manually, @@ -882,6 +886,7 @@ $db_updates = array ( array(26062, "update_8_26_2012"), array(27000, "update_11_25_2012"), array(27001, "update_4_26_2013"), + array(27002, "update_5_23_2013"), ); ?> diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index c1c1d17ea7..d651153004 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -550,6 +550,7 @@ static int modify_host_struct(HOST& host) { if (strlen(g_request->host.host_cpid)) { strcpy(host.host_cpid, g_request->host.host_cpid); } + strncpy(host.product_name, g_request->host.product_name, sizeof(host.product_name)); host.fix_nans(); return 0; diff --git a/sched/sched_types.cpp b/sched/sched_types.cpp index 04d4cf4fe7..35bf203857 100644 --- a/sched/sched_types.cpp +++ b/sched/sched_types.cpp @@ -1206,6 +1206,7 @@ int HOST::parse(XML_PARSER& xp) { if (xp.parse_double("p_membw", p_membw)) continue; if (xp.parse_str("os_name", os_name, sizeof(os_name))) continue; if (xp.parse_str("os_version", os_version, sizeof(os_version))) continue; + if (xp.parse_str("product_name", product_name, sizeof(product_name))) continue; if (xp.parse_double("m_nbytes", m_nbytes)) continue; if (xp.parse_double("m_cache", m_cache)) continue; if (xp.parse_double("m_swap", m_swap)) continue;