From a157004f4aefaa5e2265f852f9432becedee1d66 Mon Sep 17 00:00:00 2001 From: msquare Date: Sun, 23 Jul 2017 11:46:54 +0200 Subject: handle failed db queries in Db class --- includes/model/UserAngelTypes_model.php | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'includes/model/UserAngelTypes_model.php') diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php index 82f390ee..f8277fd9 100644 --- a/includes/model/UserAngelTypes_model.php +++ b/includes/model/UserAngelTypes_model.php @@ -110,22 +110,15 @@ function User_is_AngelType_supporter(&$user, $angeltype) * * @param int $user_angeltype_id * @param bool $supporter - * @return int */ function UserAngelType_update($user_angeltype_id, $supporter) { - $result = DB::update(' + DB::update(' UPDATE `UserAngelTypes` SET `supporter`=? WHERE `id`=? LIMIT 1 ', [$supporter, $user_angeltype_id]); - - if (DB::getStm()->errorCode() != '00000') { - engelsystem_error('Unable to update supporter rights.'); - } - - return $result; } /** @@ -154,22 +147,15 @@ function UserAngelTypes_delete_all($angeltype_id) * * @param int $angeltype_id * @param array $confirm_user - * @return bool */ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user) { - $result = DB::update(' + DB::update(' UPDATE `UserAngelTypes` SET `confirm_user_id`=? WHERE `angeltype_id`=? AND `confirm_user_id` IS NULL ', [$confirm_user['UID'], $angeltype_id]); - - if (DB::getStm()->errorCode() != '00000') { - engelsystem_error('Unable to confirm all users.'); - } - - return (bool)$result; } /** @@ -181,15 +167,11 @@ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user) */ function UserAngelType_confirm($user_angeltype_id, $confirm_user) { - $result = DB::update(' + DB::update(' UPDATE `UserAngelTypes` SET `confirm_user_id`=? WHERE `id`=? LIMIT 1', [$confirm_user['UID'], $user_angeltype_id]); - if (DB::getStm()->errorCode() != '00000') { - engelsystem_error('Unable to confirm user angeltype.'); - } - return (bool)$result; } /** @@ -225,10 +207,6 @@ function UserAngelType_create($user, $angeltype) ] ); - if (DB::getStm()->errorCode() != '00000') { - engelsystem_error('Unable to create user angeltype.'); - } - return DB::getPdo()->lastInsertId(); } -- cgit v1.2.3-54-g00ecf