Merge pull request #8787 from nextcloud/remove-deprecated-and-unused-methods-of-db
Remove deprecated and unsused methods of OCP\DB
This commit is contained in:
commit
3655951dd7
|
@ -165,7 +165,7 @@ class Helper {
|
|||
');
|
||||
$delRows = $query->execute(array($prefix.'%'));
|
||||
|
||||
if(\OCP\DB::isError($delRows)) {
|
||||
if($delRows === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ class Tags implements \OCP\ITags {
|
|||
}
|
||||
$entries[$objId][] = $row['category'];
|
||||
}
|
||||
if (\OCP\DB::isError($result)) {
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ class Tags implements \OCP\ITags {
|
|||
try {
|
||||
$stmt = \OCP\DB::prepare($sql);
|
||||
$result = $stmt->execute(array($tagId));
|
||||
if (\OCP\DB::isError($result)) {
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ class Tags implements \OCP\ITags {
|
|||
$stmt = \OCP\DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
|
||||
. 'WHERE `uid` = ?');
|
||||
$result = $stmt->execute(array($arguments['uid']));
|
||||
if (\OCP\DB::isError($result)) {
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
|
@ -570,7 +570,7 @@ class Tags implements \OCP\ITags {
|
|||
$stmt = \OCP\DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
|
||||
. 'WHERE `uid` = ?');
|
||||
$result = $stmt->execute(array($arguments['uid']));
|
||||
if (\OCP\DB::isError($result)) {
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
|
@ -601,7 +601,7 @@ class Tags implements \OCP\ITags {
|
|||
$updates[] = $this->type;
|
||||
$stmt = \OCP\DB::prepare($query);
|
||||
$result = $stmt->execute($updates);
|
||||
if (\OCP\DB::isError($result)) {
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ class Tags implements \OCP\ITags {
|
|||
. 'WHERE `categoryid` = ?';
|
||||
$stmt = \OCP\DB::prepare($sql);
|
||||
$result = $stmt->execute(array($id));
|
||||
if (\OCP\DB::isError($result)) {
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core',
|
||||
__METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(),
|
||||
\OCP\Util::ERROR);
|
||||
|
|
|
@ -78,22 +78,6 @@ class DB {
|
|||
return \OC::$server->getDatabaseConnection()->insertIfNotExist($table, $input, $compare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets last value of autoincrement
|
||||
* @param string $table The optional table name (will replace *PREFIX*) and add sequence suffix
|
||||
* @return string
|
||||
*
|
||||
* \Doctrine\DBAL\Connection lastInsertID()
|
||||
*
|
||||
* Call this method right after the insert command or other functions may
|
||||
* cause trouble!
|
||||
* @deprecated 8.1.0 use lastInsertId() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
|
||||
* @since 4.5.0
|
||||
*/
|
||||
public static function insertid($table=null) {
|
||||
return (string)\OC::$server->getDatabaseConnection()->lastInsertId($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a transaction
|
||||
* @deprecated 8.1.0 use beginTransaction() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
|
||||
|
@ -112,27 +96,6 @@ class DB {
|
|||
\OC::$server->getDatabaseConnection()->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback the database changes done during a transaction that is in progress
|
||||
* @deprecated 8.1.0 use rollback() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
|
||||
* @since 8.0.0
|
||||
*/
|
||||
public static function rollback() {
|
||||
\OC::$server->getDatabaseConnection()->rollBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a result is an error, works with Doctrine
|
||||
* @param mixed $result
|
||||
* @return bool
|
||||
* @deprecated 8.1.0 Doctrine returns false on error (and throws an exception)
|
||||
* @since 4.5.0
|
||||
*/
|
||||
public static function isError($result) {
|
||||
// Doctrine returns false on error (and throws an exception)
|
||||
return $result === false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the error code and message as a string for logging
|
||||
* works with DoctrineException
|
||||
|
|
Loading…
Reference in New Issue