- web: add DbConn::max() function

svn path=/trunk/boinc/; revision=25711
This commit is contained in:
David Anderson 2012-05-25 18:44:56 +00:00
parent 08a529cb86
commit 2db88e20a8
2 changed files with 9 additions and 1 deletions

View File

@ -37,7 +37,7 @@ function friendly_name($p) {
} }
if (strlen($pc)) { if (strlen($pc)) {
if (strstr($pc, 'cuda')) $q .= " (NVIDIA GPU)"; if (strstr($pc, 'cuda')) $q .= " (NVIDIA GPU)";
else if (strstr($pc, 'ati')) $q .= " (ATI GPU)"; else if (strstr($pc, 'ati')) $q .= " (AMD/ATI GPU)";
else if (strstr($pc, 'mt')) $q .= " (multicore)"; else if (strstr($pc, 'mt')) $q .= " (multicore)";
} }
return $q; return $q;

View File

@ -152,6 +152,14 @@ class DbConn {
if ($cnt) return (double)$cnt->total; if ($cnt) return (double)$cnt->total;
return null; return null;
} }
function max($table, $field, $clause="") {
$query = "select max($field) as total from ".$this->db_name.".$table $clause";
$result = $this->do_query($query);
$cnt = mysql_fetch_object($result);
mysql_free_result($result);
if ($cnt) return (double)$cnt->total;
return null;
}
function replace($table, $clause) { function replace($table, $clause) {
$query = "replace into ".$this->db_name.".$table set $clause"; $query = "replace into ".$this->db_name.".$table set $clause";
return $this->do_query($query); return $this->do_query($query);