From 00897ecc3fe900fd11ac998b6f5defeeedba8130 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 16 Dec 2013 19:22:34 -0800 Subject: [PATCH] web: remove some mysql_* calls --- html/inc/db_conn.inc | 2 ++ html/inc/util.inc | 2 -- html/inc/util_ops.inc | 26 ++++++++++---------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/html/inc/db_conn.inc b/html/inc/db_conn.inc index dd0b3e47b7..a4934a7d29 100644 --- a/html/inc/db_conn.inc +++ b/html/inc/db_conn.inc @@ -55,6 +55,8 @@ class DbConn { return $ret; } + // # rows affected by last query + // function affected_rows() { return mysql_affected_rows($this->db_conn); } diff --git a/html/inc/util.inc b/html/inc/util.inc index aef4ca3b15..8d7053f1fb 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -815,12 +815,10 @@ function db_init($try_replica=false) { $retval = db_init_aux($try_replica); if ($retval == 1) { echo tra("Unable to connect to database - please try again later"); - echo tra("Error:"), " ", mysql_errno(), mysql_error(); exit(); } if ($retval == 2) { echo tra("Unable to select database - please try again later"); - echo mysql_error(); exit(); } return 0; diff --git a/html/inc/util_ops.inc b/html/inc/util_ops.inc index 93112b700b..917276a6f8 100644 --- a/html/inc/util_ops.inc +++ b/html/inc/util_ops.inc @@ -236,11 +236,6 @@ function current_versions($avs) { return $x; } -function test_mysql_query($msg) { - echo "mysql_query($msg)
"; - return 1; -} - // cancel WUs with IDs in a given range. // This means: // @@ -248,20 +243,19 @@ function test_mysql_query($msg) { // - set the CANCELLED bit in workunit.error_mask // function cancel_wus($wuid1, $wuid2) { - $query="update result set server_state=5, outcome=5 where server_state=2 and $wuid1<=workunitid and workunitid<=$wuid2"; - if (!mysql_query($query)) { - error_page("DB query $query failed"); + $retval = BoincResult::update_aux("server_state=5, outcome=5 where server_state=2 and $wuid1<=workunitid and workunitid<=$wuid2"); + if (!$retval) { + error_page("Result update failed"); } - $query="update workunit set error_mask=error_mask|16 where $wuid1<=id and id<=$wuid2"; - if (!mysql_query($query)) { - error_page("DB query $query failed"); + $retval = BoincWorkunit::update_aux("error_mask=error_mask|16 where $wuid1<=id and id<=$wuid2"); + if (!$retval) { + error_page("Workunit update failed"); } // trigger the transitioner (it will set file_delete_state) $now = time(); - $query="update workunit set transition_time=$now where $wuid1<=id and id<=$wuid2"; - mysql_query($query); + $retval = BoincWorkunit::update_aux("transition_time=$now where $wuid1<=id and id<=$wuid2"); return 0; } @@ -273,9 +267,9 @@ function cancel_wus_if_unsent($id1, $id2) { foreach ($wus as $wu) { $results = BoincResult::enum("workunitid=$wu->id and server_state > 2"); if (count($results)) continue; - $query="update result set server_state=5, outcome=5 where workunitid=$wu->id"; - if (!mysql_query($query)) { - error_page("DB query $query failed"); + $retval = BoincResult::update_aux("server_state=5, outcome=5 where workunitid=$wu->id"); + if (!$retval) { + error_page("result update failed"); } if (!$wu->update("error_mask=error_mask|16")) { error_page("WU update failed");