summaryrefslogtreecommitdiffstats
path: root/common/queryrunner.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-08 13:18:19 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-08 13:18:19 +0100
commitae4b64b198a143240aa5dd1e202e5016abfdae71 (patch)
tree5d9d58a512ebc60c44637d11c9424f67a02887e8 /common/queryrunner.cpp
parentf425c2070131161dc11bcf70e35f8d1848cadb65 (diff)
downloadsink-ae4b64b198a143240aa5dd1e202e5016abfdae71.tar.gz
sink-ae4b64b198a143240aa5dd1e202e5016abfdae71.zip
Wrap references in a Reerence type.
This allows us to make sure that references are not taken out of context (the resource). Because we need to use the type-specific accessors more we also ran into a problem that we cannot "downcast" a reference with the change recording still working, for that we have the cast<T>() operator now.
Diffstat (limited to 'common/queryrunner.cpp')
-rw-r--r--common/queryrunner.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index cf56268..d6a90de 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -224,15 +224,15 @@ QPair<qint64, qint64> QueryWorker<DomainType>::executeInitialQuery(
224 if (!query.parentProperty().isEmpty()) { 224 if (!query.parentProperty().isEmpty()) {
225 if (parent) { 225 if (parent) {
226 SinkTrace() << "Running initial query for parent:" << parent->identifier(); 226 SinkTrace() << "Running initial query for parent:" << parent->identifier();
227 modifiedQuery.filter(query.parentProperty(), Query::Comparator(parent->identifier())); 227 modifiedQuery.filter(query.parentProperty(), Query::Comparator(QVariant::fromValue(Sink::ApplicationDomain::Reference{parent->identifier()})));
228 } else { 228 } else {
229 SinkTrace() << "Running initial query for toplevel"; 229 SinkTrace() << "Running initial query for toplevel";
230 modifiedQuery.filter(query.parentProperty(), Query::Comparator(QVariant())); 230 modifiedQuery.filter(query.parentProperty(), Query::Comparator(QVariant{}));
231 } 231 }
232 } 232 }
233 233
234 auto entityStore = EntityStore{mResourceContext}; 234 auto entityStore = EntityStore{mResourceContext};
235 auto preparedQuery = DataStoreQuery{query, ApplicationDomain::getTypeName<DomainType>(), entityStore}; 235 auto preparedQuery = DataStoreQuery{modifiedQuery, ApplicationDomain::getTypeName<DomainType>(), entityStore};
236 auto resultSet = preparedQuery.execute(); 236 auto resultSet = preparedQuery.execute();
237 237
238 SinkTrace() << "Filtered set retrieved. " << Log::TraceTime(time.elapsed()); 238 SinkTrace() << "Filtered set retrieved. " << Log::TraceTime(time.elapsed());