diff options
Diffstat (limited to 'common/storage_lmdb.cpp')
-rw-r--r-- | common/storage_lmdb.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 6a84c72..4ed9525 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -80,6 +80,7 @@ public: | |||
80 | if (allowDuplicates) { | 80 | if (allowDuplicates) { |
81 | flags |= MDB_DUPSORT; | 81 | flags |= MDB_DUPSORT; |
82 | } | 82 | } |
83 | Q_ASSERT(transaction); | ||
83 | if (const int rc = mdb_dbi_open(transaction, db.constData(), flags, &dbi)) { | 84 | if (const int rc = mdb_dbi_open(transaction, db.constData(), flags, &dbi)) { |
84 | dbi = 0; | 85 | dbi = 0; |
85 | transaction = 0; | 86 | transaction = 0; |
@@ -428,6 +429,7 @@ Storage::NamedDatabase Storage::Transaction::openDatabase(const QByteArray &db, | |||
428 | if (!d) { | 429 | if (!d) { |
429 | return Storage::NamedDatabase(); | 430 | return Storage::NamedDatabase(); |
430 | } | 431 | } |
432 | Q_ASSERT(d->transaction); | ||
431 | // We don't now if anything changed | 433 | // We don't now if anything changed |
432 | d->implicitCommit = true; | 434 | d->implicitCommit = true; |
433 | auto p = new Storage::NamedDatabase::Private(db, allowDuplicates, d->defaultErrorHandler, d->name, d->transaction); | 435 | auto p = new Storage::NamedDatabase::Private(db, allowDuplicates, d->defaultErrorHandler, d->name, d->transaction); |
@@ -559,14 +561,14 @@ Storage::Transaction Storage::createTransaction(AccessMode type, const std::func | |||
559 | { | 561 | { |
560 | auto errorHandler = errorHandlerArg ? errorHandlerArg : defaultErrorHandler(); | 562 | auto errorHandler = errorHandlerArg ? errorHandlerArg : defaultErrorHandler(); |
561 | if (!d->env) { | 563 | if (!d->env) { |
562 | errorHandler(Error(d->name.toLatin1(), ErrorCodes::GenericError, "Missing database environment")); | 564 | errorHandler(Error(d->name.toLatin1(), ErrorCodes::GenericError, "Failed to create transaction: Missing database environment")); |
563 | return Transaction(); | 565 | return Transaction(); |
564 | } | 566 | } |
565 | 567 | ||
566 | bool requestedRead = type == ReadOnly; | 568 | bool requestedRead = type == ReadOnly; |
567 | 569 | ||
568 | if (d->mode == ReadOnly && !requestedRead) { | 570 | if (d->mode == ReadOnly && !requestedRead) { |
569 | errorHandler(Error(d->name.toLatin1(), ErrorCodes::GenericError, "Requested read/write transaction in read-only mode.")); | 571 | errorHandler(Error(d->name.toLatin1(), ErrorCodes::GenericError, "Failed to create transaction: Requested read/write transaction in read-only mode.")); |
570 | return Transaction(); | 572 | return Transaction(); |
571 | } | 573 | } |
572 | 574 | ||