@@ -139,7 +139,7 @@ public function getAddressBooksForUserCount($principalUri) {
139139 ->from ('addressbooks ' )
140140 ->where ($ query ->expr ()->eq ('principaluri ' , $ query ->createNamedParameter ($ principalUri )));
141141
142- $ result = $ query ->execute ();
142+ $ result = $ query ->executeQuery ();
143143 $ column = (int ) $ result ->fetchOne ();
144144 $ result ->closeCursor ();
145145 return $ column ;
@@ -1130,15 +1130,18 @@ private function searchByAddressBookIds(array $addressBookIds,
11301130 return (int )$ match ['cardid ' ];
11311131 }, $ matches );
11321132
1133+ $ cards = [];
11331134 $ query = $ this ->db ->getQueryBuilder ();
11341135 $ query ->select ('c.addressbookid ' , 'c.carddata ' , 'c.uri ' )
11351136 ->from ($ this ->dbCardsTable , 'c ' )
1136- ->where ($ query ->expr ()->in ('c.id ' , $ query ->createNamedParameter ($ matches , IQueryBuilder::PARAM_INT_ARRAY )));
1137-
1138- $ result = $ query ->execute ();
1139- $ cards = $ result ->fetchAll ();
1137+ ->where ($ query ->expr ()->in ('c.id ' , $ query ->createParameter ('matches ' )));
11401138
1141- $ result ->closeCursor ();
1139+ foreach (array_chunk ($ matches , 1000 ) as $ matchesChunk ) {
1140+ $ query ->setParameter ('matches ' , $ matchesChunk , IQueryBuilder::PARAM_INT_ARRAY );
1141+ $ result = $ query ->executeQuery ();
1142+ $ cards = array_merge ($ cards , $ result ->fetchAll ());
1143+ $ result ->closeCursor ();
1144+ }
11421145
11431146 return array_map (function ($ array ) {
11441147 $ array ['addressbookid ' ] = (int ) $ array ['addressbookid ' ];
0 commit comments