]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
mysql try catch gorenest
authorBanana <mail@bananas-playground.net>
Fri, 1 Jan 2021 14:52:24 +0000 (15:52 +0100)
committerBanana <mail@bananas-playground.net>
Fri, 1 Jan 2021 14:52:24 +0000 (15:52 +0100)
webclient/lib/gorenest.class.php

index f73b010d14fdf66af25ac5ca7eb49ca54b92b3d1..08fbb42f5263814758db4d6497fbede453cd0280 100644 (file)
@@ -79,12 +79,17 @@ class GoreNest {
                                        WHERE ".$this->_User->getSQLRightsString()."
                                                AND `category` = '".$this->_DB->real_escape_string($category)."'
                                                ORDER BY position";
-               $query  = $this->_DB->query($queryStr);
-               if($query !== false && $query->num_rows > 0) {
-                       while(($result = $query->fetch_assoc()) != false) {
-                               $this->_menuData[$result['category']][$result['id']] = $result;
+               try {
+                       $query  = $this->_DB->query($queryStr);
+                       if($query !== false && $query->num_rows > 0) {
+                               while(($result = $query->fetch_assoc()) != false) {
+                                       $this->_menuData[$result['category']][$result['id']] = $result;
+                               }
                        }
                }
+               catch (Exception $e) {
+                       error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+               }
 
                return $this->_menuData[$category];
        }
@@ -99,12 +104,17 @@ class GoreNest {
                $queryStr = "SELECT id, action
                                        FROM `".DB_PREFIX."_menu`
                                        WHERE ".$this->_User->getSQLRightsString()."";
-               $query  = $this->_DB->query($queryStr);
-               if($query !== false && $query->num_rows > 0) {
-                       while(($result = $query->fetch_assoc()) != false) {
-                               $ret[$result['action']] = $result['action'];
+               try {
+                       $query  = $this->_DB->query($queryStr);
+                       if($query !== false && $query->num_rows > 0) {
+                               while(($result = $query->fetch_assoc()) != false) {
+                                       $ret[$result['action']] = $result['action'];
+                               }
                        }
                }
+               catch (Exception $e) {
+                       error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+               }
 
                return $ret;
        }