Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
query_transformation.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2013 Mateusz Loskot <mateusz@loskot.net>
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_QUERY_TRANSFORMATION_H_INCLUDED
9
#define SOCI_QUERY_TRANSFORMATION_H_INCLUDED
10
11
#include "
soci-config.h
"
12
#include <functional>
13
#include <string>
14
15
namespace
soci
16
{
17
18
namespace
details
19
{
20
21
// Query transformation is a mechanism that enables user to apply
22
// any string-to-string transformation to SQL statement just
23
// before it is executed.
24
// Transformation procedure is specified by user,
25
// be it a function or an arbitrary type as long as it
26
// defines operator() with the appropriate signature:
27
// unary function takes any type converible-to std::string
28
// and returns std::string.
29
30
class
query_transformation_function
31
:
public
std::unary_function<std::string const&, std::string>
32
{
33
public
:
34
virtual
~query_transformation_function
() {}
35
virtual
result_type
operator()
(argument_type a)
const
= 0;
36
};
37
38
template
<
typename
T>
39
class
query_transformation
:
public
query_transformation_function
40
{
41
public
:
42
query_transformation
(T callback)
43
: callback_(callback)
44
{}
45
46
result_type
operator()
(argument_type query)
const
47
{
48
return
callback_(query);
49
}
50
51
private
:
52
T
callback_
;
53
};
54
55
}
// namespace details
56
57
}
// namespace soci
58
59
#endif // SOCI_QUERY_TRANSFORMATION_H_INCLUDED
soci::details::query_transformation::operator()
result_type operator()(argument_type query) const
Definition:
query_transformation.h:46
soci::details::query_transformation_function::~query_transformation_function
virtual ~query_transformation_function()
Definition:
query_transformation.h:34
soci::details::query_transformation_function
Definition:
query_transformation.h:30
soci::details::query_transformation_function::operator()
virtual result_type operator()(argument_type a) const =0
soci::details::query_transformation
Definition:
query_transformation.h:39
soci::details::query_transformation::callback_
T callback_
Definition:
query_transformation.h:52
soci-config.h
soci
Definition:
db2/common.h:15
soci::details::query_transformation::query_transformation
query_transformation(T callback)
Definition:
query_transformation.h:42
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