22 #define ERR_SQL LOG_STREAM(err, log_sql_handler) 29 r.game_name = rslt->get_string(
"GAME_NAME");
30 r.reload = rslt->get_boolean(
"RELOAD");
31 r.game_start = rslt->get_date_time(
"START_TIME").str();
32 r.scenario_name = rslt->get_string(
"SCENARIO_NAME");
33 r.scenario_id = rslt->get_string(
"SCENARIO_ID");
34 r.era_name = rslt->get_string(
"ERA_NAME");
35 r.era_id = rslt->get_string(
"ERA_ID");
36 for(
const auto& player_info :
utils::split(rslt->get_string(
"PLAYERS")))
41 r.players.emplace_back(player{ info[0], info[1] });
45 ERR_SQL <<
"Expected player information to split into two fields, instead found the value `" << player_info <<
"`." << std::endl;
48 r.modification_names =
utils::split(rslt->get_string(
"MODIFICATION_NAMES"));
49 r.modification_ids =
utils::split(rslt->get_string(
"MODIFICATION_IDS"));
50 r.replay_url = rslt->get_string(
"REPLAY_URL");
51 results.push_back(std::move(r));
57 auto doc = std::make_unique<simple_wml::document>();
58 for(
const auto& result :
results)
63 ghr.
set_attr_dup(
"game_start", result.game_start.c_str());
64 ghr.
set_attr_dup(
"scenario_name", result.scenario_name.c_str());
65 ghr.
set_attr_dup(
"scenario_id", result.scenario_id.c_str());
68 for(
const auto& player : result.players)
74 for(
const auto& mod : result.modification_names)
79 for(
const auto& mod : result.modification_ids)
node & add_child(const char *name)
void read(mariadb::result_set_ref rslt)
node & set_attr_int(const char *key, int value)
std::vector< result > results
node & set_attr_dup(const char *key, const char *value)
std::vector< std::string > split(const config_attribute_value &val)
std::unique_ptr< simple_wml::document > to_doc()