summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/pipeline.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index acccd90..01db980 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -159,7 +159,19 @@ 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
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;
171 return KAsync::error<qint64>(0);
172 }
162 } 173 }
174
163 if (key.isEmpty()) { 175 if (key.isEmpty()) {
164 key = QUuid::createUuid().toString().toUtf8(); 176 key = QUuid::createUuid().toString().toUtf8();
165 } 177 }