diff options
author | Joas Schilling <coding@schilljs.com> | 2017-09-25 12:12:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 12:12:50 +0200 |
commit | e0a4c61350813ff7f501ac6917ea77d9943720b1 (patch) | |
tree | a5f972bc47c6df56e99b84cc3867a9ddaf500830 /apps | |
parent | 4677af1a91f65ef17a5191b55db9ab773bdff570 (diff) | |
parent | f1bfd4433e90f3781a82e9e8efec088f6aa77e59 (diff) | |
download | nextcloud-server-e0a4c61350813ff7f501ac6917ea77d9943720b1.tar.gz nextcloud-server-e0a4c61350813ff7f501ac6917ea77d9943720b1.zip |
Merge pull request #6633 from nextcloud/dav-remove-like-when-not-needed
Don't add a LIKE condition when it's not needed
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/CardDAV/CardDavBackend.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 7c275611951..2e4acad6dfe 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -890,7 +890,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { $or->add($query2->expr()->eq('cp.name', $query->createNamedParameter($property))); } $query2->andWhere($or); - $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); + + // No need for like when the pattern is empty + if ('' !== $pattern) { + $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); + } $query->select('c.carddata', 'c.uri')->from($this->dbCardsTable, 'c') ->where($query->expr()->in('c.id', $query->createFunction($query2->getSQL()))); |