diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 19:51:34 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 19:51:34 +0100 |
commit | b259728a4f63e022526ef86e6b5d6c62d9938d13 (patch) | |
tree | a59e240b331df95ad621ca0530a4decedfac42f4 /common/pipeline.cpp | |
parent | a793c8d1c7a872db6152aa197c7a305f97644630 (diff) | |
download | sink-b259728a4f63e022526ef86e6b5d6c62d9938d13.tar.gz sink-b259728a4f63e022526ef86e6b5d6c62d9938d13.zip |
Use the contains function where we can.
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r-- | common/pipeline.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp index d850154..f8b1fb1 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp | |||
@@ -159,14 +159,7 @@ KAsync::Job<qint64> Pipeline::newEntity(void const *command, size_t size) | |||
159 | QByteArray key; | 159 | QByteArray key; |
160 | if (createEntity->entityId()) { | 160 | if (createEntity->entityId()) { |
161 | key = QByteArray(reinterpret_cast<char const*>(createEntity->entityId()->Data()), createEntity->entityId()->size()); | 161 | key = QByteArray(reinterpret_cast<char const*>(createEntity->entityId()->Data()), createEntity->entityId()->size()); |
162 | 162 | if (d->transaction.openDatabase(bufferType + ".main").contains(key)) { | |
163 | bool found = false; | ||
164 | d->transaction.openDatabase(bufferType + ".main").scan(key, [&found](const QByteArray &, const QByteArray &value) -> bool { | ||
165 | found = true; | ||
166 | return false; | ||
167 | }, [this](const Akonadi2::Storage::Error &error) { | ||
168 | }, true); | ||
169 | if (found) { | ||
170 | ErrorMsg() << "An entity with this id already exists: " << key; | 163 | ErrorMsg() << "An entity with this id already exists: " << key; |
171 | return KAsync::error<qint64>(0); | 164 | return KAsync::error<qint64>(0); |
172 | } | 165 | } |