summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 780883f9d800f205131c73cb1e478056076b082f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "hearthstoneAPIHandler.h"
#include "postgresHandler.h"
#include <iostream>
#include <pqxx/pqxx>

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);
    return 0;
}