YAPOG  0.0.1
Yet Another Pokemon Online Game
PlayerDataSelectRequest.cpp
Go to the documentation of this file.
5 
6 namespace yse
7 {
10  PlayerDataTable& playerDataTable)
11  {
12  yap::String queryString =
13  "SELECT "
14  "player_data_position, "
15  "player_data_map_id, "
16  "player_data_time, "
17  "player_data_step_count, "
18  "player_data_respawn_spot, "
19  "player_data_flee_count, "
20  "player_data_box_number, "
21  "player_data_battle_count, "
22  "player_data_money "
23  "FROM player_data "
24  "WHERE account_id = :accountID";
25 
26  yap::DatabaseStream select (queryString, dm.GetConnection ());
27 
28  select.Write (playerDataTable.GetAccountID ().GetValue ());
29 
30  if (select.EndOfStream ())
31  throw yap::Exception ("This account doesn't have any player data !");
32 
33  playerDataTable.SetPosition (select.ReadVector2 ());
34  playerDataTable.SetMapID (select.ReadID ());
35  playerDataTable.SetPlayTime (select.ReadInt ());
36  playerDataTable.SetStepCount (select.ReadInt ());
37  playerDataTable.SetRespawnSpot (select.ReadVector2 ());
38  playerDataTable.SetFleeCount (select.ReadInt ());
39  playerDataTable.SetBoxNumber (select.ReadInt ());
40  playerDataTable.SetBattleCount (select.ReadInt ());
41  playerDataTable.SetMoney (select.ReadInt ());
42 
43  if (!select.EndOfStream ())
44  throw yap::Exception ("Account information loading error !");
45  }
46 } // namespace yse