YAPOG  0.0.1
Yet Another Pokemon Online Game
AccountInsertRequest.cpp
Go to the documentation of this file.
4 
5 namespace yse
6 {
8  : accountTable_ (accountTable)
9  , id_ ()
10  {
11  }
12 
14  {
15  }
16 
18  {
19  yap::String query_string =
20  "INSERT INTO account ("
21  "account_name, "
22  "account_password, "
23  "account_email, "
24  "account_permissions, "
25  "account_creation_date, "
26  "account_last_login_date, "
27  "account_creation_ip) "
28  "VALUES ("
29  ":name, "
30  ":pass, "
31  ":email, "
32  ":perm, "
33  "NOW (), "
34  "NOW (), "
35  ":creationIp) "
36  "RETURNING account_id";
37 
38  yap::DatabaseStream query
39  (query_string, databaseManager.GetConnection ());
40 
41  query.Write (accountTable_.GetName ());
42  query.Write (accountTable_.GetPassword ());
43  query.Write (accountTable_.GetEmail ());
44  query.Write (static_cast<int> (accountTable_.GetPermissions ()));
45  query.Write (accountTable_.GetCreationIP ());
46 
47  id_ = yap::ID (query.ReadInt ());
48 
49  return true;
50  }
51 
53  {
54  return id_;
55  }
56 } // namespace yse