diff options
author | Joas Schilling <coding@schilljs.com> | 2020-11-09 17:33:32 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-10 15:36:27 +0100 |
commit | fbda2d1d253b99a4e83970e023ede42faad87966 (patch) | |
tree | 8ad9dfe78a9d8304bc3b71f680196aa4794768c3 | |
parent | 1aa9c9164d73be7aabb5a2ff18e8999c55e33a48 (diff) | |
download | nextcloud-server-fbda2d1d253b99a4e83970e023ede42faad87966.tar.gz nextcloud-server-fbda2d1d253b99a4e83970e023ede42faad87966.zip |
Don't try to update on NotNullConstraintViolationException, only on unique or foreign key
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/private/DB/Connection.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 0ea71637943..ebb3900f3e5 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -39,6 +39,7 @@ use Doctrine\DBAL\Configuration; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Exception\ConstraintViolationException; +use Doctrine\DBAL\Exception\NotNullConstraintViolationException; use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Schema\Schema; use OC\DB\QueryBuilder\QueryBuilder; @@ -322,6 +323,8 @@ class Connection extends ReconnectWrapper implements IDBConnection { }, array_merge($keys, $values)) ); return $insertQb->execute(); + } catch (NotNullConstraintViolationException $e) { + throw $e; } catch (ConstraintViolationException $e) { // value already exists, try update $updateQb = $this->getQueryBuilder(); |