diff options
| author | Aotrix <[email protected]> | 2025-03-18 19:21:57 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-03-18 19:21:57 +0100 |
| commit | 332c0ffde6d60b7bac3cb14df31cbae3f27383a7 (patch) | |
| tree | 80c22ed8f36be4399ca174c9d3ceac6da7cb2fab /src/postgresHandler.cpp | |
| parent | 9c280e05547671aa346530c4c7c0ddbc4729348f (diff) | |
added postgres handler
Diffstat (limited to 'src/postgresHandler.cpp')
| -rw-r--r-- | src/postgresHandler.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/postgresHandler.cpp b/src/postgresHandler.cpp new file mode 100644 index 0000000..212202e --- /dev/null +++ b/src/postgresHandler.cpp @@ -0,0 +1,25 @@ +#include "postgresHandler.h" +#include <iostream> +#include <regex> + +const pqxx::result execute_query(pqxx::work &t_transaction, + std::string_view t_query) { + return t_transaction.exec(t_query); +} + +void display_query_result(const pqxx::result &t_r) { + const int nb_columns = t_r.columns(); + for (const auto &row : t_r) { + for (int i = 0; i < nb_columns; i++) { + std::cout << row[i].c_str() << " | "; + } + std::cout << std::endl; + } +} + +void add_cards_to_database(std::string_view t_cards, pqxx::work &t_tx) { + // TODO: to complete + std::cout << "adding cards..." << std::endl; + std::regex key_regex; // TODO: to define + std::cout << t_cards.substr(1, 6) << std::endl; +} |
