Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Code
Common
otbPostGISConnectionImplementation.cxx
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: ORFEO Toolbox
4
Language: C++
5
Date: $Date$
6
Version: $Revision$
7
8
9
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10
See OTBCopyright.txt for details.
11
12
13
This software is distributed WITHOUT ANY WARRANTY; without even
14
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
PURPOSE. See the above copyright notices for more information.
16
17
=========================================================================*/
18
#include "
otbPostGISConnectionImplementation.h
"
19
#include <sstream>
20
#include <sstream>
21
#include <assert.h>
22
23
namespace
otb
24
{
25
PostGISConnectionImplementation::PostGISConnectionImplementation
()
26
{
27
m_Host
=
"localhost"
;
28
m_DBName
=
""
;
29
m_User
=
"postgres"
;
30
m_Password
=
""
;
31
m_Port
=
"5432"
;
32
m_Options
=
""
;
33
34
}
35
36
PostGISConnectionImplementation::~PostGISConnectionImplementation
()
37
{
38
39
}
40
41
void
PostGISConnectionImplementation::ConnectToDB
()
42
{
43
std::stringstream connstring;
44
45
connstring <<
"host="
<<
m_Host
<<
" dbname="
<<
m_DBName
<<
" user="
<<
m_User
;
46
47
if
(
m_Password
!=
""
) connstring <<
" password="
<<
m_Password
;
48
49
if
(
m_Port
!=
""
) connstring <<
" port="
<<
m_Port
;
50
51
if
(
m_Options
!=
""
) connstring <<
" options="
<<
m_Options
;
52
53
if
(!
m_PostGISConnection
)
delete
m_PostGISConnection
;
54
55
m_PostGISConnection
=
new
BasicConnectionType
(connstring.str().c_str());
56
57
}
58
59
void
PostGISConnectionImplementation::PerformTransaction
(
const
TransactorType
& theTransaction)
const
60
{
61
//assert(0); //do not use this method yet
62
//m_PostGISConnection->perform( theTransaction );
63
}
64
65
PostGISConnectionImplementation::BasicConnectionType
*
PostGISConnectionImplementation::GetConnection
()
const
66
{
67
return
m_PostGISConnection
;
68
}
69
70
void
PostGISConnectionImplementation::PrintSelf
(std::ostream& os,
itk::Indent
indent)
const
71
{
72
Superclass::PrintSelf
(os, indent);
73
os << std::endl;
74
75
os <<
"DB name: "
<<
m_DBName
<< std::endl;
76
77
}
78
79
}
// end namespace otb
Generated at Sun Feb 3 2013 00:42:26 for
Orfeo Toolbox
with
doxygen 1.8.1.1