From 50a6cf2e28758f83eecc0e46f39e044be519a8e4 Mon Sep 17 00:00:00 2001 From: Aotrix Date: Tue, 25 Mar 2025 22:00:39 +0100 Subject: you can now add columns in cards table! --- src/main.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 780883f..de64d9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,20 +5,16 @@ int main() { HearthstoneAPIHandler hs_handler; - // TODO: use a parser on get_cards returned value - // 642; 678 - const unsigned int card_id = 678; - std::cout << hs_handler.get_cards(std::format("{}?locale=fr_FR", card_id)) - << 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( - hs_handler.get_cards(std::format("{}?locale=fr_FR", card_id)), tx); + const unsigned int card_id = 217; + std::string card = + hs_handler.get_cards(std::format("{}?locale=fr_FR", card_id)); + std::cout << card << std::endl; + add_cards_to_database(card, tx); + + tx.commit(); return 0; } -- cgit v1.2.3