Skip to content

Commit

Permalink
Merge pull request #36795 from nextcloud/fix/remove-erronous-parenthe…
Browse files Browse the repository at this point in the history
…ses-in-in-clause

Avoid extra parenthesis around SQL in IN expressions
  • Loading branch information
come-nc authored Feb 21, 2023
2 parents a789288 + 7481181 commit 18c4761
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions apps/files_sharing/lib/External/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ protected function removeReShares($mountPointId) {


$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();
Expand Down Expand Up @@ -730,10 +730,10 @@ public function removeGroupShares($gid): bool {
// 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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Repair/RemoveLinkShares.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function getTotal(): int {
$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();
Expand Down

0 comments on commit 18c4761

Please sign in to comment.