Skip to content

Commit

Permalink
return without reset
Browse files Browse the repository at this point in the history
  • Loading branch information
anarthal committed Dec 6, 2024
1 parent 62b27e2 commit 91b646d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example/3_advanced/http_server_cpp20/repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ asio::awaitable<std::optional<order_with_items>> db_repository::add_order_item(
result2
);

// If everything went well, we didn't mutate session state
conn.return_without_reset();

// Compose the return value
co_return order_with_items{
ord.id,
Expand Down Expand Up @@ -275,6 +278,9 @@ asio::awaitable<std::optional<order_with_items>> db_repository::remove_order_ite
result
);

// We didn't mutate session state
conn.return_without_reset();

// Check that the order exists
if (result.rows<2>().empty())
{
Expand Down Expand Up @@ -349,6 +355,9 @@ static asio::awaitable<std::optional<order_with_items>> change_order_status(
result2
);

// If everything went well, we didn't mutate session state
conn.return_without_reset();

// Compose the return value
co_return order_with_items{
order_id,
Expand Down

0 comments on commit 91b646d

Please sign in to comment.