diff options
| author | Aotrix <[email protected]> | 2025-03-04 02:59:53 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-03-04 02:59:53 +0100 |
| commit | afbca22035804f7fc65032d0c66bf198e7739bd5 (patch) | |
| tree | 2c72c1ef6fd838f0cf4dfec38b6bf549d73d13a0 /src/main.cpp | |
| parent | 69fdcc280a09872ff9d5d7e6b1debd9934cad26b (diff) | |
we can now connect to the database!
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 57dd2d7..4282118 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,10 +1,20 @@ +#include <format> #include <iostream> #include <pqxx/pqxx> // TODO: Parser les cartes int main() { - std::cout << "Decomposer le problème en des sous-problèmes" << std::endl; // TODO: Récupérer le nombre de cartes + pqxx::connection cx{ + "postgresql://aotrix@localhost:5432/hearthstonegameinfo"}; + pqxx::work tx{cx}; + pqxx::result r{tx.exec("SELECT * FROM cards")}; + for (auto row : r) { + std::cout << std::format( + "{}; {}; {}; {}; {}", row[0].as<std::string>(), + row[1].as<std::string>(), row[2].as<std::string>(), + row[3].as<std::string>(), row[4].as<std::string>()); + } return 0; } |
