diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-01-07 10:14:05 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-01-07 14:54:55 +0100 |
commit | 3917d888bde42336abb1d2ecbef04ae7530e5c14 (patch) | |
tree | 6254348690ce58fbaf651fb3f5d76d87c728a63b /lib/private/db.php | |
parent | 547fbfdb76cf2094a9f75a73bb7eef385ed97cf6 (diff) | |
download | nextcloud-server-3917d888bde42336abb1d2ecbef04ae7530e5c14.tar.gz nextcloud-server-3917d888bde42336abb1d2ecbef04ae7530e5c14.zip |
Remove OC_DB::isError
Diffstat (limited to 'lib/private/db.php')
-rw-r--r-- | lib/private/db.php | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/private/db.php b/lib/private/db.php index f339855fb20..bac0f600e95 100644 --- a/lib/private/db.php +++ b/lib/private/db.php @@ -263,15 +263,6 @@ class OC_DB { } /** - * check if a result is an error, works with Doctrine - * @param mixed $result - * @return bool - */ - public static function isError($result) { - //Doctrine returns false on error (and throws an exception) - return $result === false; - } - /** * check if a result is an error and throws an exception, works with \Doctrine\DBAL\DBALException * @param mixed $result * @param string $message @@ -279,20 +270,16 @@ class OC_DB { * @throws \OC\DatabaseException */ public static function raiseExceptionOnError($result, $message = null) { - if(self::isError($result)) { + if($result === false) { if ($message === null) { $message = self::getErrorMessage(); } else { $message .= ', Root cause:' . self::getErrorMessage(); } - throw new \OC\DatabaseException($message, self::getErrorCode()); + throw new \OC\DatabaseException($message, \OC::$server->getDatabaseConnection()->errorCode()); } } - public static function getErrorCode() { - $connection = \OC::$server->getDatabaseConnection(); - return $connection->errorCode(); - } /** * returns the error code and message as a string for logging * works with DoctrineException |