YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
AccountInsertRequest.cpp
Go to the documentation of this file.
1
#include "
Database/Requests/Inserts/AccountInsertRequest.hpp
"
2
#include "
Database/Tables/AccountTable.hpp
"
3
#include "
YAPOG/Database/DatabaseStream.hpp
"
4
5
namespace
yse
6
{
7
AccountInsertRequest::AccountInsertRequest
(
const
AccountTable
& accountTable)
8
: accountTable_ (accountTable)
9
, id_ ()
10
{
11
}
12
13
AccountInsertRequest::~AccountInsertRequest
()
14
{
15
}
16
17
bool
AccountInsertRequest::Insert
(
yap::DatabaseManager
& databaseManager)
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
52
const
yap::ID
&
AccountInsertRequest::GetID
()
53
{
54
return
id_
;
55
}
56
}
// namespace yse
YAPOG.Server
src
Database
Requests
Inserts
AccountInsertRequest.cpp
Generated on Mon Sep 17 2012 22:24:22 for YAPOG by
1.8.1.1