From 5d0a48d6fa3ac0649451a03bd7d6f38ec671e4f0 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 22 Sep 2021 10:51:47 -0400 Subject: [PATCH] core(dav): improve SQL queries of multiget and sync-collection --- SoObjects/SOGo/SOGoGCSFolder.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 3c6c44606..1d72dc14f 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -1989,7 +1989,7 @@ static NSArray *childRecordFields = nil; components = [NSMutableArray arrayWithCapacity: max]; for (count = 0; count < max; count++) { - currentName = [cNames objectAtIndex: count]; + currentName = [[cNames objectAtIndex: count] asSafeSQLString]; queryNameLength = idQueryOverhead + [currentName length]; if ((currentSize + queryNameLength) > maxQuerySize) @@ -2003,8 +2003,11 @@ static NSArray *childRecordFields = nil; currentSize += queryNameLength; } - records = [self _fetchComponentsWithNames: currentNames fields: fields]; - [components addObjectsFromArray: records]; + if ([currentNames count]) + { + records = [self _fetchComponentsWithNames: currentNames fields: fields]; + [components addObjectsFromArray: records]; + } // NSLog (@"/fetching components matching names");