Skip to content

Commit

Permalink
Merge pull request #27729 from nextcloud/revert-26587-backport/26581/…
Browse files Browse the repository at this point in the history
…stable21

[stable21] Revert "Fix constraint violation detection in QB Mapper"
  • Loading branch information
skjnldsv authored Jul 27, 2021
2 parents 0aed3ec + affe972 commit ab233d5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace OCP\AppFramework\Db;

use OCP\DB\Exception;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;

Expand Down Expand Up @@ -162,11 +162,8 @@ public function insert(Entity $entity): Entity {
public function insertOrUpdate(Entity $entity): Entity {
try {
return $this->insert($entity);
} catch (Exception $ex) {
if ($ex->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
return $this->update($entity);
}
throw $ex;
} catch (UniqueConstraintViolationException $ex) {
return $this->update($entity);
}
}

Expand Down

0 comments on commit ab233d5

Please sign in to comment.