Postgres#62
Open
dietmarkuehl wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds additional Postgres “talk” example programs under examples/ and updates the Postgres examples CMake wiring to build them when Postgres is available.
Changes:
- Updated
postgres-talk.cppwith revisedpg::execerror handling/logging and a refactoredmutexsender wrapper usage inmain(). - Added two new presentation-oriented variants:
postgres-talk-accuonsea.cppandpostgres-talk-c++now.cpp. - Extended
examples/CMakeLists.txtto build the new Postgres talk examples whenHAS_POSTGRESis enabled.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| examples/postgres-talk.cpp | Refactors the Postgres async query path and example orchestration. |
| examples/postgres-talk-c++now.cpp | Adds an additional Postgres talk example variant. |
| examples/postgres-talk-accuonsea.cpp | Adds another Postgres talk example variant based on the updated approach. |
| examples/CMakeLists.txt | Registers the new examples in the build when Postgres is present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
66
to
69
| if (!PQsendQuery(conn, query.c_str())) { | ||
| co_yield ex::with_error(pg::error(PQerrorMessage(conn))); | ||
| std::cout << "ERROR: " << PQerrorMessage(conn) << "\n"; | ||
| throw std::runtime_error("ERROR"); | ||
| } |
Comment on lines
79
to
81
| if (!PQconsumeInput(conn)) { | ||
| co_yield ex::with_error(pg::error(PQerrorMessage(conn))); | ||
| // error handling | ||
| } |
| } | ||
| } | ||
| co_return std::move(res); | ||
| co_return res; |
| @@ -0,0 +1,214 @@ | |||
| // examples/postgres-talk.cpp -*-C++-*- | |||
Comment on lines
+66
to
+69
| if (!PQsendQuery(conn, query.c_str())) { | ||
| std::cout << "ERROR: " << PQerrorMessage(conn) << "\n"; | ||
| throw std::runtime_error("ERROR"); | ||
| } |
Comment on lines
+79
to
+81
| if (!PQconsumeInput(conn)) { | ||
| // error handling | ||
| } |
| break; | ||
| } | ||
| } | ||
| co_return res; |
| @@ -0,0 +1,217 @@ | |||
| // examples/postgres-talk.cpp -*-C++-*- | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adding presentation code