Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
connection-parameters.h
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
#ifndef SOCI_CONNECTION_PARAMETERS_H_INCLUDED
9
#define SOCI_CONNECTION_PARAMETERS_H_INCLUDED
10
11
#include "
soci-config.h
"
12
13
#include <map>
14
#include <string>
15
16
namespace
soci
17
{
18
19
class
backend_factory;
20
21
// Simple container for the information used when opening a session.
22
class
SOCI_DECL
connection_parameters
23
{
24
public
:
25
connection_parameters
();
26
connection_parameters
(
backend_factory
const
& factory, std::string
const
&
connectString
);
27
connection_parameters
(std::string
const
& backendName, std::string
const
& connectString);
28
explicit
connection_parameters
(std::string
const
& fullConnectString);
29
30
// Default copy ctor, assignment operator and dtor are all OK for us.
31
32
33
// Retrieve the backend and the connection strings specified in the ctor.
34
backend_factory
const
*
get_factory
()
const
{
return
factory_; }
35
std::string
const
&
get_connect_string
()
const
{
return
connectString_; }
36
37
// Set the value of the given option, overwriting any previous value.
38
void
set_option
(
const
char
* name, std::string
const
& value)
39
{
40
options_[name] = value;
41
}
42
43
// Return true if the option with the given name was found and fill the
44
// provided parameter with its value.
45
bool
get_option
(
const
char
* name, std::string & value)
const
46
{
47
Options::const_iterator
const
it = options_.find(name);
48
if
(it == options_.end())
49
return
false
;
50
51
value = it->second;
52
53
return
true
;
54
}
55
56
private
:
57
// The backend and connection string specified in our ctor.
58
backend_factory
const
*
factory_
;
59
std::string
connectString_
;
60
61
// We store all the values as strings for simplicity.
62
typedef
std::map<const char*, std::string>
Options
;
63
Options
options_
;
64
};
65
66
}
// namespace soci
67
68
#endif // SOCI_CONNECTION_PARAMETERS_H_INCLUDED
soci::connection_parameters::connectString_
std::string connectString_
Definition:
connection-parameters.h:59
soci::connection_parameters::set_option
void set_option(const char *name, std::string const &value)
Definition:
connection-parameters.h:38
soci::connection_parameters::get_connect_string
std::string const & get_connect_string() const
Definition:
connection-parameters.h:35
SOCI_DECL
#define SOCI_DECL
Definition:
soci-config.h:31
soci::connection_parameters
Definition:
connection-parameters.h:22
connectString
std::string connectString
Definition:
test-db2.cpp:21
soci::connection_parameters::factory_
backend_factory const * factory_
Definition:
connection-parameters.h:58
soci::connection_parameters::Options
std::map< const char *, std::string > Options
Definition:
connection-parameters.h:62
soci::connection_parameters::options_
Options options_
Definition:
connection-parameters.h:63
soci-config.h
soci::connection_parameters::get_factory
backend_factory const * get_factory() const
Definition:
connection-parameters.h:34
soci::connection_parameters::get_option
bool get_option(const char *name, std::string &value) const
Definition:
connection-parameters.h:45
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