Skip to content

Commit

Permalink
Revert "[stable21] Fix constraint violation detection in QB Mapper"
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophWurst authored Jun 30, 2021
1 parent e76b833 commit affe972
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 affe972

Please sign in to comment.