diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-26 14:08:05 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-26 14:34:32 -0600 |
commit | 097b3f2e75395f2e069386835f2e45bd665f7bad (patch) | |
tree | 3703c3708ba407d4dbafadc5c2274a8f5e005999 | |
parent | e56b4b24df2aec5b90595d40b1260c72f06ba2c0 (diff) | |
download | kube-097b3f2e75395f2e069386835f2e45bd665f7bad.tar.gz kube-097b3f2e75395f2e069386835f2e45bd665f7bad.zip |
Avoid executing queries with empty filters
-rw-r--r-- | framework/src/accounts/accountfactory.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/framework/src/accounts/accountfactory.cpp b/framework/src/accounts/accountfactory.cpp index 9dbb402b..c7f3855b 100644 --- a/framework/src/accounts/accountfactory.cpp +++ b/framework/src/accounts/accountfactory.cpp | |||
@@ -43,11 +43,13 @@ QString AccountFactory::name() const | |||
43 | void AccountFactory::setAccountId(const QString &accountId) | 43 | void AccountFactory::setAccountId(const QString &accountId) |
44 | { | 44 | { |
45 | mAccountId = accountId; | 45 | mAccountId = accountId; |
46 | Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query().filter(accountId.toUtf8())) | 46 | if (!accountId.isEmpty()) { |
47 | .then([this](const Sink::ApplicationDomain::SinkAccount &account) { | 47 | Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query().filter(accountId.toUtf8())) |
48 | mAccountType = account.getProperty("type").toByteArray(); | 48 | .then([this](const Sink::ApplicationDomain::SinkAccount &account) { |
49 | loadPackage(); | 49 | mAccountType = account.getProperty("type").toByteArray(); |
50 | }).exec(); | 50 | loadPackage(); |
51 | }).exec(); | ||
52 | } | ||
51 | } | 53 | } |
52 | 54 | ||
53 | void AccountFactory::setAccountType(const QString &type) | 55 | void AccountFactory::setAccountType(const QString &type) |