From 50b1faf812f1e1109daf5f385d7644880243e187 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 4 Dec 2023 13:11:52 +0100 Subject: [PATCH] fix(DB): Fix "IS NOT NULL" database queries Signed-off-by: Joas Schilling --- lib/DB/Place/PlaceMapper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/DB/Place/PlaceMapper.php b/lib/DB/Place/PlaceMapper.php index ba8213c59..77a271e4a 100644 --- a/lib/DB/Place/PlaceMapper.php +++ b/lib/DB/Place/PlaceMapper.php @@ -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(); @@ -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(); @@ -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(); @@ -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();