summaryrefslogtreecommitdiffstats
path: root/common/datastorequery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/datastorequery.cpp')
-rw-r--r--common/datastorequery.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/common/datastorequery.cpp b/common/datastorequery.cpp
index f3d9415..f5152b7 100644
--- a/common/datastorequery.cpp
+++ b/common/datastorequery.cpp
@@ -208,6 +208,7 @@ public:
208 }; 208 };
209 209
210 QSet<QByteArray> mReducedValues; 210 QSet<QByteArray> mReducedValues;
211 QSet<QByteArray> mIncrementallyReducedValues;
211 QHash<QByteArray, QByteArray> mSelectedValues; 212 QHash<QByteArray, QByteArray> mSelectedValues;
212 QByteArray mReductionProperty; 213 QByteArray mReductionProperty;
213 QByteArray mSelectionProperty; 214 QByteArray mSelectionProperty;
@@ -225,6 +226,11 @@ public:
225 226
226 virtual ~Reduce(){} 227 virtual ~Reduce(){}
227 228
229 void updateComplete() Q_DECL_OVERRIDE
230 {
231 mIncrementallyReducedValues.clear();
232 }
233
228 static QByteArray getByteArray(const QVariant &value) { 234 static QByteArray getByteArray(const QVariant &value) {
229 if (value.type() == QVariant::DateTime) { 235 if (value.type() == QVariant::DateTime) {
230 return value.toDateTime().toString().toLatin1(); 236 return value.toDateTime().toString().toLatin1();
@@ -304,7 +310,8 @@ public:
304 //During initial query, do nothing. The lookup above will take care of it. 310 //During initial query, do nothing. The lookup above will take care of it.
305 //During updates adjust the reduction according to the modification/addition or removal 311 //During updates adjust the reduction according to the modification/addition or removal
306 //We have to redo the reduction for every element, because of the aggregation values. 312 //We have to redo the reduction for every element, because of the aggregation values.
307 if (mIncremental) { 313 if (mIncremental && !mIncrementallyReducedValues.contains(reductionValueBa)) {
314 mIncrementallyReducedValues.insert(reductionValueBa);
308 //Redo the reduction to find new aggregated values 315 //Redo the reduction to find new aggregated values
309 QMap<QByteArray, QVariant> aggregateValues; 316 QMap<QByteArray, QVariant> aggregateValues;
310 auto selectionResult = reduceOnValue(reductionValue, aggregateValues); 317 auto selectionResult = reduceOnValue(reductionValue, aggregateValues);
@@ -621,6 +628,11 @@ ResultSet DataStoreQuery::update(qint64 baseRevision)
621void DataStoreQuery::updateComplete() 628void DataStoreQuery::updateComplete()
622{ 629{
623 mSource->mIncrementalIds.clear(); 630 mSource->mIncrementalIds.clear();
631 auto source = mCollector;
632 while (source) {
633 source->updateComplete();
634 source = source->mSource;
635 }
624} 636}
625 637
626ResultSet DataStoreQuery::execute() 638ResultSet DataStoreQuery::execute()