Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
type-conversion-traits.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
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_TYPE_CONVERSION_TRAITS_H_INCLUDED
9
#define SOCI_TYPE_CONVERSION_TRAITS_H_INCLUDED
10
11
#include "
soci-backend.h
"
12
13
namespace
soci
14
{
15
16
// default traits class type_conversion, acts as pass through for row::get()
17
// when no actual conversion is needed.
18
template
<
typename
T,
typename
Enable =
void
>
19
struct
type_conversion
20
{
21
typedef
T
base_type
;
22
23
static
void
from_base
(base_type
const
& in,
indicator
ind, T & out)
24
{
25
if
(ind ==
i_null
)
26
{
27
throw
soci_error
(
"Null value not allowed for this type"
);
28
}
29
out = in;
30
}
31
32
static
void
to_base
(T
const
& in, base_type & out,
indicator
& ind)
33
{
34
out = in;
35
ind =
i_ok
;
36
}
37
};
38
39
}
// namespace soci
40
41
#endif // SOCI_TYPE_CONVERSION_TRAITS_H_INCLUDED
soci-backend.h
soci::i_null
Definition:
soci-backend.h:28
soci::type_conversion::to_base
static void to_base(T const &in, base_type &out, indicator &ind)
Definition:
type-conversion-traits.h:32
soci::type_conversion::base_type
T base_type
Definition:
type-conversion-traits.h:21
soci::soci_error
Definition:
core/error.h:19
soci::i_ok
Definition:
soci-backend.h:28
soci::type_conversion::from_base
static void from_base(base_type const &in, indicator ind, T &out)
Definition:
type-conversion-traits.h:23
soci::indicator
indicator
Definition:
soci-backend.h:28
soci
Definition:
db2/common.h:15
soci::type_conversion
Definition:
type-conversion-traits.h:19
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:41