YAPOG  0.0.1
Yet Another Pokemon Online Game
AccountSelectRequest.cpp
Go to the documentation of this file.
4 
5 namespace yse
6 {
9  const yap::String& name,
10  AccountTable& accountTable)
11  {
12  yap::String queryString =
13  "SELECT account_id, "
14  "account_password, "
15  "account_email, "
16  "account_permissions, "
17  "account_creation_date, "
18  "account_creation_ip, "
19  "account_current_ip "
20  "FROM account "
21  "WHERE account_name = :name";
22 
23  yap::DatabaseStream select (queryString, dm.GetConnection ());
24  select.Write (name);
25 
26  if (select.EndOfStream ())
27  throw yap::DatabaseException ("This account doesn't exist !");
28 
29  // Set the value of this account with the database information
30  accountTable.SetID (yap::ID (select.ReadInt ()));
31  accountTable.SetName (name);
32  accountTable.SetPassword (select.ReadString ());
33  accountTable.SetEmail (select.ReadString ());
34  accountTable.SetPermissions
35  (static_cast<AccountPermission> (select.ReadInt ()));
36  accountTable.SetCreationDate (select.ReadString ());
37  accountTable.SetCreationIP (select.ReadString ());
38  accountTable.SetCurrentIP (select.ReadString ());
39 
40  if (!select.EndOfStream ())
41  throw yap::Exception ("Account information loading error !");
42  }
43 } // namespace yse