#include "hearthstoneAPIHandler.h" #include #include 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(), row[1].as(), row[2].as(), row[3].as(), row[4].as()); } } int main() { HearthstoneAPIHandler hs_handler; std::cout << hs_handler.get_cards("678?locale=en_US") << std::endl; pqxx::connection cx{ "postgresql://aotrix@localhost:5432/hearthstonegameinfo"}; pqxx::work tx{cx}; display_query_result(execute_query(tx, "SELECT * FROM cards")); return 0; }