summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-08-12 00:58:28 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-08-12 00:58:28 +0200
commitde860ce15b0921a37c0f3a21dbebe4311b9414a8 (patch)
tree4422df93c2cda64ecda44fcdfe53a60d640f6e93
parent9812595ee44819e9bd4b430f275ef3941aaf038e (diff)
downloadsink-de860ce15b0921a37c0f3a21dbebe4311b9414a8.tar.gz
sink-de860ce15b0921a37c0f3a21dbebe4311b9414a8.zip
Support for nested transactions
-rw-r--r--common/storage_lmdb.cpp2
-rw-r--r--tests/storagetest.cpp12
2 files changed, 13 insertions, 1 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp
index 23df0fc..983d0e2 100644
--- a/common/storage_lmdb.cpp
+++ b/common/storage_lmdb.cpp
@@ -317,7 +317,7 @@ Storage::Private::Private(const QString &s, const QString &n, AccessMode m, bool
317 // TODO: handle error 317 // TODO: handle error
318 std::cerr << "mdb_env_create: " << rc << " " << mdb_strerror(rc) << std::endl; 318 std::cerr << "mdb_env_create: " << rc << " " << mdb_strerror(rc) << std::endl;
319 } else { 319 } else {
320 if ((rc = mdb_env_open(env, fullPath.toStdString().data(), mode == ReadOnly ? MDB_RDONLY : 0 , 0664))) { 320 if ((rc = mdb_env_open(env, fullPath.toStdString().data(), mode == ReadOnly ? MDB_RDONLY : 0 | MDB_NOTLS, 0664))) {
321 std::cerr << "mdb_env_open: " << rc << " " << mdb_strerror(rc) << std::endl; 321 std::cerr << "mdb_env_open: " << rc << " " << mdb_strerror(rc) << std::endl;
322 mdb_env_close(env); 322 mdb_env_close(env);
323 env = 0; 323 env = 0;
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index b71a767..55ec888 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -142,6 +142,18 @@ private Q_SLOTS:
142 }); 142 });
143 } 143 }
144 144
145 void testNestedTransactions()
146 {
147 populate(3);
148 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
149 store.createTransaction(Akonadi2::Storage::ReadOnly).scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool {
150 store.createTransaction(Akonadi2::Storage::ReadWrite).remove(key, [](const Akonadi2::Storage::Error &) {
151 QVERIFY(false);
152 });
153 return false;
154 });
155 }
156
145 void testReadEmptyDb() 157 void testReadEmptyDb()
146 { 158 {
147 bool gotResult = false; 159 bool gotResult = false;