From 74811813e7218f5c24d199086f5b56f8c476ef45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Tue, 21 Feb 2023 12:13:02 +0100 Subject: [PATCH] Avoid extra parenthesis around SQL in IN expressions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The expression builder already suround the SQL with parenthesis when using in(), so we must not add another pair, this confuses at least sqlite. Signed-off-by: Côme Chilliet --- apps/files_sharing/lib/External/Manager.php | 10 +++++----- lib/private/Repair/RemoveLinkShares.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index 68bc6801e46..d2e113c8bb3 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -660,7 +660,7 @@ class Manager { $query->delete('federated_reshares') - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); + ->where($query->expr()->in('share_id', $query->createFunction($select))); $query->execute(); $deleteReShares = $this->connection->getQueryBuilder(); @@ -730,10 +730,10 @@ class Manager { // delete group share entry and matching sub-entries $qb->delete('share_external') ->where( - $qb->expr()->orX( - $qb->expr()->eq('id', $qb->createParameter('share_id')), - $qb->expr()->eq('parent', $qb->createParameter('share_parent_id')) - ) + $qb->expr()->orX( + $qb->expr()->eq('id', $qb->createParameter('share_id')), + $qb->expr()->eq('parent', $qb->createParameter('share_parent_id')) + ) ); foreach ($shares as $share) { diff --git a/lib/private/Repair/RemoveLinkShares.php b/lib/private/Repair/RemoveLinkShares.php index e1ce78cdbf3..71eead1053b 100644 --- a/lib/private/Repair/RemoveLinkShares.php +++ b/lib/private/Repair/RemoveLinkShares.php @@ -126,7 +126,7 @@ class RemoveLinkShares implements IRepairStep { $query = $this->connection->getQueryBuilder(); $query->select($query->func()->count('*', 'total')) ->from('share') - ->where($query->expr()->in('id', $query->createFunction('(' . $subQuery->getSQL() . ')'))); + ->where($query->expr()->in('id', $query->createFunction($subQuery->getSQL()))); $result = $query->execute(); $data = $result->fetch(); -- 2.39.5