diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/main.cpp b/src/main.cpp index 90a4fe6..6786a5b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,29 +1,20 @@ #include "hearthstoneAPIHandler.h" +#include "postgresHandler.h" #include <iostream> #include <pqxx/pqxx> -const pqxx::result execute_query(pqxx::work &t_transaction, - std::string_view t_query) { - return t_transaction.exec(t_query); -} - -void display_query_result(pqxx::result t_r) { - // FIXME: not flexible - for (auto row : t_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>()); - } -} - int main() { HearthstoneAPIHandler hs_handler; - std::cout << hs_handler.get_cards("678?locale=en_US") << std::endl; + // TODO: use a parser on get_cards returned value + std::cout << hs_handler.get_cards("678?locale=fr_FR") << std::endl; pqxx::connection cx{ "postgresql://aotrix@localhost:5432/hearthstonegameinfo"}; pqxx::work tx{cx}; display_query_result(execute_query(tx, "SELECT * FROM cards")); + + // TODO: for test purposes + // use get_cards output instead? + add_cards_to_database("{\"name\":3}", tx); return 0; } |
