YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
DatabaseManager.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Database/DatabaseManager.hpp
"
2
#include "
YAPOG/System/StringHelper.hpp
"
3
4
namespace
yap
5
{
6
DatabaseManager::DatabaseManager
()
7
: dl_ (nullptr)
8
{
9
}
10
11
DatabaseManager::~DatabaseManager
()
12
{
13
}
14
15
void
DatabaseManager::Connect
()
16
{
17
try
18
{
19
connection_
.
connect
(
20
"dbname=yapog "
21
"user=postgres "
22
"password=COUCOU "
23
"port=5432"
);
24
}
25
catch
(
pgs::pg_excpt
e)
26
{
27
std::cerr << e.
full_error_txt
();
28
}
29
}
30
31
void
DatabaseManager::SetLogStream
(
OStream
& os)
32
{
33
if
(
dl_
!=
nullptr
)
34
YAPOG_THROW
(
"The log stream is already set !"
);
35
36
dl_
=
new
DatabaseLogger
(os);
37
}
38
39
pgs::pg_cnx
&
DatabaseManager::GetConnection
()
40
{
41
return
connection_
;
42
}
43
44
DatabaseLogger
&
DatabaseManager::GetDatabaseLogger
()
45
{
46
return
*
dl_
;
47
}
48
49
}
// namespace yap
YAPOG
src
YAPOG
Database
DatabaseManager.cpp
Generated on Mon Sep 17 2012 22:24:24 for YAPOG by
1.8.1.1