Skip to content

Commit

Permalink
Fixed bug when an action was rolled backl from the transactions const…
Browse files Browse the repository at this point in the history
…ructor.
  • Loading branch information
jgaa committed Apr 20, 2024
1 parent 3d401c9 commit 81a3432
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions include/mysqlpool/mysqlpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class Mysqlpool {
MYSQLPOOL_LOG_DEBUG_("Handle failed. Transaction not committed or rolled back!)");
return;
}
assert(!handle_);
assert(handle_);
handle_->rollbackAndReleaseLater();
}
}
Expand Down Expand Up @@ -476,6 +476,8 @@ class Mysqlpool {
: parent_{std::exchange(v.parent_, {})}
, connection_{std::exchange(v.connection_, {})}
, uuid_{std::exchange(v.uuid_, {})}
, has_transaction_{std::exchange(v.has_transaction_, false)}
, failed_{std::exchange(v.failed_, false)}
{
}

Expand All @@ -489,12 +491,11 @@ class Mysqlpool {

Handle& operator = (const Handle) = delete;
Handle& operator = (Handle && v) noexcept {
parent_ = v.parent_;
v.parent_ = {};
connection_ = v.connection_;
v.connection_ = {};
v.uuid_ = uuid_;
uuid_ = {};
parent_ = std::exchange(v.parent_, {});
connection_ = std::exchange(v.connection_, {});
uuid_ = std::exchange(v.uuid_, {});
has_transaction_ = std::exchange(v.has_transaction_, false);
failed_ = std::exchange(v.failed_, false);
return *this;
}

Expand Down

0 comments on commit 81a3432

Please sign in to comment.