Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DB): Fix "IS NOT NULL" database queries #2171

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading