Skip to content

Commit

Permalink
fix(DB): Fix "IS NOT NULL" database queries
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot-nextcloud[bot] committed Dec 4, 2023
1 parent 4da520b commit 50b1faf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/DB/Place/PlaceMapper.php
Original file line number Diff line number Diff line change
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 50b1faf

Please sign in to comment.