# HG changeset patch # User Alain Mazy # Date 1748247412 -7200 # Node ID 48a49be02483739889a8050553d3e98180f22363 # Parent ffed14a83433ac2917929b69d23200d0326a6d8c nested sqlite read-only transactions diff -r ffed14a83433 -r 48a49be02483 OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Wed May 21 23:46:37 2025 +0200 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Mon May 26 10:16:52 2025 +0200 @@ -2469,25 +2469,33 @@ { private: SQLiteDatabaseWrapper& that_; + bool isNested_; // see explanation on the ReadWriteTransaction public: ReadOnlyTransaction(SQLiteDatabaseWrapper& that, IDatabaseListener& listener) : TransactionBase(that.mutex_, that.db_, listener, *that.signalRemainingAncestor_), - that_(that) + that_(that), + isNested_(false) { if (that_.activeTransaction_ != NULL) { - throw OrthancException(ErrorCode_InternalError); + isNested_ = true; + // throw OrthancException(ErrorCode_InternalError); } - - that_.activeTransaction_ = this; + else + { + that_.activeTransaction_ = this; + } } virtual ~ReadOnlyTransaction() { - assert(that_.activeTransaction_ != NULL); - that_.activeTransaction_ = NULL; + if (!isNested_) + { + assert(that_.activeTransaction_ != NULL); + that_.activeTransaction_ = NULL; + } } virtual void Rollback() ORTHANC_OVERRIDE