Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-03-10 17:10:08 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-03-11 19:06:57 +0300
commit0ffa730d34d70cd69884a51477eadd4be4652d0a (patch)
treeb320ba0aacdc2f5e5b3e639a8ad3ec38ad0ae63f
parent5a91ebd2ae5c40db59e2fa1b25eed1b2ad1e667a (diff)
Don't recreate sql query each timebackport/31274/stable21
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index e622bb2b277..5c081841581 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -139,7 +139,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->from('addressbooks')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
- $result = $query->execute();
+ $result = $query->executeQuery();
$column = (int) $result->fetchOne();
$result->closeCursor();
return $column;
@@ -1111,18 +1111,18 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}, $matches);
$cards = [];
- foreach (array_chunk($matches, 1000) as $matche) {
- $query = $this->db->getQueryBuilder();
- $query->select('c.addressbookid', 'c.carddata', 'c.uri')
- ->from($this->dbCardsTable, 'c')
- ->where($query->expr()->in('c.id', $query->createNamedParameter($matche, IQueryBuilder::PARAM_INT_ARRAY)));
+ $query = $this->db->getQueryBuilder();
+ $query->select('c.addressbookid', 'c.carddata', 'c.uri')
+ ->from($this->dbCardsTable, 'c')
+ ->where($query->expr()->in('c.id', $query->createParameter('matches')));
- $result = $query->execute();
+ foreach (array_chunk($matches, 1000) as $matchesChunk) {
+ $query->setParameter('matches', $matchesChunk, IQueryBuilder::PARAM_INT_ARRAY);
+ $result = $query->executeQuery();
$cards = array_merge($cards, $result->fetchAll());
$result->closeCursor();
}
-
return array_map(function ($array) {
$array['addressbookid'] = (int) $array['addressbookid'];
$modified = false;