Skip to content

Commit

Permalink
Merge pull request #2173 from nextcloud/backport/2171/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(DB): Fix "IS NOT NULL" database queries
  • Loading branch information
artonge committed Dec 6, 2023
2 parents a318ee7 + 50b1faf commit 3deebdd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/DB/Place/PlaceMapper.php
Expand Up @@ -62,7 +62,7 @@ public function findPlacesForUser(string $userId): array {
$metadataQuery->joinIndex(self::METADATA_KEY);
$rows = $qb->where($qb->expr()->eq('file.storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->in('file.mimetype', $qb->createNamedParameter($mimetypes, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere('meta_value_string IS NOT NULL')
->andWhere($qb->expr()->isNotNull('meta_value_string'))
->executeQuery()
->fetchAll();

Expand All @@ -87,7 +87,7 @@ public function findPlaceForUser(string $userId, string $place): PlaceInfo {
$rows = $qb->where($qb->expr()->eq('file.storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->in('file.mimetype', $qb->createNamedParameter($mimetypes, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->eq('meta_value_string', $qb->createNamedParameter($place)))
->andWhere('meta_value_string IS NOT NULL')
->andWhere($qb->expr()->isNotNull('meta_value_string'))
->executeQuery()
->fetchAll();

Expand Down Expand Up @@ -116,7 +116,7 @@ public function findFilesForUserAndPlace(string $userId, string $place) {
$rows = $qb->where($qb->expr()->eq('file.storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->in('file.mimetype', $qb->createNamedParameter($mimetypes, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->eq('meta_value_string', $qb->createNamedParameter($place)))
->andWhere('meta_value_string IS NOT NULL')
->andWhere($qb->expr()->isNotNull('meta_value_string'))
->executeQuery()
->fetchAll();

Expand Down Expand Up @@ -153,7 +153,7 @@ public function findFileForUserAndPlace(string $userId, string $place, string $f
->andWhere($qb->expr()->eq('file.name', $qb->createNamedParameter($fileName)))
->andWhere($qb->expr()->in('file.mimetype', $qb->createNamedParameter($mimetypes, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->eq('meta_value_string', $qb->createNamedParameter($place)))
->andWhere('meta_value_string IS NOT NULL')
->andWhere($qb->expr()->isNotNull('meta_value_string'))
->executeQuery()
->fetchAll();

Expand Down

0 comments on commit 3deebdd

Please sign in to comment.