Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
connection-parameters.cpp
Go to the documentation of this file.
1
//
2
// Copyright (C) 2013 Vadim Zeitlin
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
//
7
8
#define SOCI_SOURCE
9
#include "
connection-parameters.h
"
10
#include "
soci-backend.h
"
11
#include "
backend-loader.h
"
12
13
using namespace
soci
;
14
15
namespace
// anonymous
16
{
17
18
void
parseConnectString(std::string
const
&
connectString
,
19
std::string & backendName,
20
std::string & connectionParameters)
21
{
22
std::string
const
protocolSeparator =
"://"
;
23
24
std::string::size_type
const
p = connectString.find(protocolSeparator);
25
if
(p == std::string::npos)
26
{
27
throw
soci_error
(
"No backend name found in "
+ connectString);
28
}
29
30
backendName = connectString.substr(0, p);
31
connectionParameters = connectString.substr(p + protocolSeparator.size());
32
}
33
34
}
// namespace anonymous
35
36
connection_parameters::connection_parameters
()
37
: factory_(NULL)
38
{
39
}
40
41
connection_parameters::connection_parameters
(
backend_factory
const
& factory,
42
std::string
const
&
connectString
)
43
:
factory_
(&factory),
connectString_
(connectString)
44
{
45
}
46
47
connection_parameters::connection_parameters
(std::string
const
& backendName,
48
std::string
const
&
connectString
)
49
:
factory_
(&dynamic_backends::
get
(backendName)),
connectString_
(connectString)
50
{
51
}
52
53
connection_parameters::connection_parameters
(std::string
const
& fullConnectString)
54
{
55
std::string backendName;
56
std::string
connectString
;
57
58
parseConnectString(fullConnectString, backendName, connectString);
59
60
factory_
= &
dynamic_backends::get
(backendName);
61
connectString_
=
connectString
;
62
}
soci::connection_parameters::connectString_
std::string connectString_
Definition:
connection-parameters.h:59
soci-backend.h
connection-parameters.h
backend-loader.h
soci::soci_error
Definition:
core/error.h:19
soci::dynamic_backends::get
backend_factory const & get(std::string const &name)
Definition:
backend-loader.cpp:258
soci::connection_parameters::connection_parameters
connection_parameters()
Definition:
connection-parameters.cpp:36
connectString
std::string connectString
Definition:
test-db2.cpp:21
soci::connection_parameters::factory_
backend_factory const * factory_
Definition:
connection-parameters.h:58
soci
Definition:
db2/common.h:15
soci::backend_factory
Definition:
soci-backend.h:265
asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40