22 #define ERR_SQL LOG_STREAM(err, log_sql_handler)
29 r.game_name = rslt->get_string(
"GAME_NAME");
30 r.game_start = rslt->get_date_time(
"START_TIME").str();
31 r.scenario_name = rslt->get_string(
"SCENARIO_NAME");
32 r.era_name = rslt->get_string(
"ERA_NAME");
33 for(
const auto& player_info :
utils::split(rslt->get_string(
"PLAYERS")))
38 r.players.emplace_back(player{
info[0],
info[1] });
42 ERR_SQL <<
"Expected player information to split into two fields, instead found the value `" << player_info <<
"`.";
45 r.modification_names =
utils::split(rslt->get_string(
"MODIFICATION_NAMES"));
46 r.replay_url = rslt->get_string(
"REPLAY_URL");
47 r.version = rslt->get_string(
"VERSION");
48 results.push_back(std::move(r));
54 auto doc = std::make_unique<simple_wml::document>();
58 for(
const auto& result :
results)
62 ghr.
set_attr_dup(
"game_start", result.game_start.c_str());
63 ghr.
set_attr_dup(
"scenario_name", result.scenario_name.c_str());
65 ghr.
set_attr_dup(
"replay_url", result.replay_url.c_str());
67 for(
const auto& player : result.players)
70 p.set_attr_dup(
"name", player.name.c_str());
71 p.set_attr_dup(
"faction", player.faction.c_str());
73 for(
const auto& mod : result.modification_names)
void read(mariadb::result_set_ref rslt)
std::unique_ptr< simple_wml::document > to_doc()
std::vector< result > results
node & add_child(const char *name)
node & set_attr_dup(const char *key, const char *value)
std::vector< std::string > split(const config_attribute_value &val)