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 
31  : public std::unary_function<std::string const&, std::string>
32 {
33 public:
35  virtual result_type operator()(argument_type a) const = 0;
36 };
37 
38 template <typename T>
40 {
41 public:
43  : callback_(callback)
44  {}
45 
46  result_type operator()(argument_type query) const
47  {
48  return callback_(query);
49  }
50 
51 private:
53 };
54 
55 } // namespace details
56 
57 } // namespace soci
58 
59 #endif // SOCI_QUERY_TRANSFORMATION_H_INCLUDED
result_type operator()(argument_type query) const
virtual result_type operator()(argument_type a) const =0


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