summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/queryrunner.cpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index 4fab68d..1ef076e 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -180,34 +180,36 @@ QueryWorker<DomainType>::~QueryWorker()
180template<class DomainType> 180template<class DomainType>
181void QueryWorker<DomainType>::replaySet(ResultSet &resultSet, Sink::ResultProviderInterface<typename DomainType::Ptr> &resultProvider, const QList<QByteArray> &properties, int offset, int batchSize) 181void QueryWorker<DomainType>::replaySet(ResultSet &resultSet, Sink::ResultProviderInterface<typename DomainType::Ptr> &resultProvider, const QList<QByteArray> &properties, int offset, int batchSize)
182{ 182{
183 int counter = 0; 183 Trace() << "Skipping over " << offset << " results";
184 resultSet.skip(offset); 184 resultSet.skip(offset);
185 while (resultSet.next([this, &resultProvider, &counter, &properties, batchSize](const Sink::ApplicationDomain::ApplicationDomainType::Ptr &value, Sink::Operation operation) -> bool { 185 int counter;
186 //FIXME allow maildir resource to set the mimeMessage property 186 for (counter = 0; !batchSize || (counter < batchSize); counter++) {
187 auto valueCopy = Sink::ApplicationDomain::ApplicationDomainType::getInMemoryRepresentation<DomainType>(*value, properties).template staticCast<DomainType>(); 187 const bool ret = resultSet.next([this, &resultProvider, &counter, &properties, batchSize](const Sink::ApplicationDomain::ApplicationDomainType::Ptr &value, Sink::Operation operation) -> bool {
188 if (mResultTransformation) { 188 //FIXME allow maildir resource to set the mimeMessage property
189 mResultTransformation(*valueCopy); 189 auto valueCopy = Sink::ApplicationDomain::ApplicationDomainType::getInMemoryRepresentation<DomainType>(*value, properties).template staticCast<DomainType>();
190 } 190 if (mResultTransformation) {
191 if (batchSize && counter >= batchSize) { 191 mResultTransformation(*valueCopy);
192 return false; 192 }
193 } 193 switch (operation) {
194 counter++; 194 case Sink::Operation_Creation:
195 switch (operation) { 195 // Trace() << "Got creation";
196 case Sink::Operation_Creation: 196 resultProvider.add(valueCopy);
197 // Trace() << "Got creation"; 197 break;
198 resultProvider.add(valueCopy); 198 case Sink::Operation_Modification:
199 break; 199 // Trace() << "Got modification";
200 case Sink::Operation_Modification: 200 resultProvider.modify(valueCopy);
201 // Trace() << "Got modification"; 201 break;
202 resultProvider.modify(valueCopy); 202 case Sink::Operation_Removal:
203 break; 203 // Trace() << "Got removal";
204 case Sink::Operation_Removal: 204 resultProvider.remove(valueCopy);
205 // Trace() << "Got removal"; 205 break;
206 resultProvider.remove(valueCopy); 206 }
207 return true;
208 });
209 if (!ret) {
207 break; 210 break;
208 } 211 }
209 return true; 212 };
210 })){};
211 Trace() << "Replayed " << counter << " results." << "Limit " << batchSize; 213 Trace() << "Replayed " << counter << " results." << "Limit " << batchSize;
212} 214}
213 215