summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAotrix <[email protected]>2025-03-04 02:59:53 +0100
committerAotrix <[email protected]>2025-03-04 02:59:53 +0100
commitafbca22035804f7fc65032d0c66bf198e7739bd5 (patch)
tree2c72c1ef6fd838f0cf4dfec38b6bf549d73d13a0
parent69fdcc280a09872ff9d5d7e6b1debd9934cad26b (diff)
we can now connect to the database!
-rw-r--r--src/main.cpp12
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;
}