YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
AccountSelectRequest.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Database/DatabaseStream.hpp
"
2
#include "
YAPOG/System/Error/DatabaseException.hpp
"
3
#include "
Database/Requests/Selects/AccountSelectRequest.hpp
"
4
5
namespace
yse
6
{
7
AccountSelectRequest::AccountSelectRequest
(
8
yap::DatabaseManager
& dm,
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
YAPOG.Server
src
Database
Requests
Selects
AccountSelectRequest.cpp
Generated on Mon Sep 17 2012 22:24:22 for YAPOG by
1.8.1.1