Merge pull request #8914 from nextcloud/remove-unused-db-methods

Remove unused and deprecated methods of OCP\DB
This commit is contained in:
Morris Jobke 2018-03-21 13:28:27 +01:00 committed by GitHub
commit 98b1f3fd57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 35 deletions

View File

@ -237,7 +237,7 @@ class Tags implements \OCP\ITags {
$entries[$objId][] = $row['category'];
}
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
return false;
}
}
@ -291,7 +291,7 @@ class Tags implements \OCP\ITags {
$stmt = \OCP\DB::prepare($sql);
$result = $stmt->execute(array($tagId));
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
return false;
}
} catch(\Exception $e) {
@ -534,7 +534,7 @@ class Tags implements \OCP\ITags {
. 'WHERE `uid` = ?');
$result = $stmt->execute(array($arguments['uid']));
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
}
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
@ -572,7 +572,7 @@ class Tags implements \OCP\ITags {
. 'WHERE `uid` = ?');
$result = $stmt->execute(array($arguments['uid']));
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
}
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
@ -603,7 +603,7 @@ class Tags implements \OCP\ITags {
$stmt = \OCP\DB::prepare($query);
$result = $stmt->execute($updates);
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
return false;
}
} catch(\Exception $e) {
@ -773,7 +773,7 @@ class Tags implements \OCP\ITags {
$result = $stmt->execute(array($id));
if ($result === null) {
\OCP\Util::writeLog('core',
__METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(),
__METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(),
\OCP\Util::ERROR);
return false;
}

View File

@ -61,33 +61,4 @@ class DB {
return \OC_DB::prepare($query, $limit, $offset);
}
/**
* Start a transaction
* @deprecated 8.1.0 use beginTransaction() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
* @since 4.5.0
*/
public static function beginTransaction() {
\OC::$server->getDatabaseConnection()->beginTransaction();
}
/**
* Commit the database changes done during a transaction that is in progress
* @deprecated 8.1.0 use commit() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
* @since 4.5.0
*/
public static function commit() {
\OC::$server->getDatabaseConnection()->commit();
}
/**
* returns the error code and message as a string for logging
* works with DoctrineException
* @return string
* @deprecated 8.1.0 use getError() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
* @since 6.0.0
*/
public static function getErrorMessage() {
return \OC::$server->getDatabaseConnection()->getError();
}
}