diff options
author | Simon Rettberg | 2022-05-02 18:49:09 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-02 18:49:09 +0200 |
commit | 5eb8df7432a708284862e4b126e418265d36b4ab (patch) | |
tree | d8812cc2bd6245e0b02ca6866a4c14e977e1bb62 /inc/database.inc.php | |
parent | [rebootcontrol] Show time of execution for WOL/reboot/shutdown (diff) | |
download | slx-admin-5eb8df7432a708284862e4b126e418265d36b4ab.tar.gz slx-admin-5eb8df7432a708284862e4b126e418265d36b4ab.tar.xz slx-admin-5eb8df7432a708284862e4b126e418265d36b4ab.zip |
[inc/Util] Add types, move error printing functions to their own class
Diffstat (limited to 'inc/database.inc.php')
-rw-r--r-- | inc/database.inc.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/inc/database.inc.php b/inc/database.inc.php index 8d50a02d..8f2ba6d1 100644 --- a/inc/database.inc.php +++ b/inc/database.inc.php @@ -34,7 +34,7 @@ class Database } catch (PDOException $e) { if (self::$returnErrors) return false; - Util::traceError('Connecting to the local database failed: ' . $e->getMessage()); + ErrorHandler::traceError('Connecting to the local database failed: ' . $e->getMessage()); } if (CONFIG_DEBUG) { Database::exec("SET SESSION sql_mode='STRICT_ALL_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO'"); @@ -203,7 +203,7 @@ class Database self::$lastError = implode("\n", $stmt->errorInfo()); if ($ignoreError === true || ($ignoreError === null && self::$returnErrors)) return false; - Util::traceError("Database Error: \n" . self::$lastError); + ErrorHandler::traceError("Database Error: \n" . self::$lastError); } if (CONFIG_DEBUG) { $duration = microtime(true) - $start; @@ -221,7 +221,7 @@ class Database self::$lastError = '(' . $e->getCode() . ') ' . $e->getMessage(); if ($ignoreError === true || ($ignoreError === null && self::$returnErrors)) return false; - Util::traceError("Database Error: \n" . self::$lastError); + ErrorHandler::traceError("Database Error: \n" . self::$lastError); } return false; } @@ -383,10 +383,10 @@ class Database { // Sanity checks if (array_key_exists($aiKey, $uniqueValues)) { - Util::traceError("$aiKey must not be in \$uniqueValues"); + ErrorHandler::traceError("$aiKey must not be in \$uniqueValues"); } if (is_array($additionalValues) && array_key_exists($aiKey, $additionalValues)) { - Util::traceError("$aiKey must not be in \$additionalValues"); + ErrorHandler::traceError("$aiKey must not be in \$additionalValues"); } // Simple SELECT first $selectSql = 'SELECT ' . $aiKey . ' FROM ' . $table . ' WHERE 1'; @@ -444,7 +444,7 @@ class Database // Insert done, retrieve key again $res = self::queryFirst($selectSql, $uniqueValues); if ($res === false) { - Util::traceError('Could not find value in table ' . $table . ' that was just inserted'); + ErrorHandler::traceError('Could not find value in table ' . $table . ' that was just inserted'); } return $res[$aiKey]; } |