values-exchange.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_VALUES_EXCHANGE_H_INCLUDED
9 #define SOCI_VALUES_EXCHANGE_H_INCLUDED
10 
11 #include "values.h"
12 #include "into-type.h"
13 #include "use-type.h"
14 #include "row-exchange.h"
15 // std
16 #include <cstddef>
17 #include <string>
18 #include <vector>
19 
20 namespace soci
21 {
22 
23 namespace details
24 {
25 
26 template <>
28 {
30 
31  // dummy value to satisfy the template engine, never used
32  enum { x_type = 0 };
33 };
34 
35 template <>
36 class use_type<values> : public use_type_base
37 {
38 public:
39  use_type(values & v, std::string const & /*name*/ = std::string())
40  : v_(v)
41  {}
42 
43  // we ignore the possibility to have the whole values as NULL
44  use_type(values & v, indicator /*ind*/, std::string const & /*name*/ = std::string())
45  : v_(v)
46  {}
47 
48  virtual void bind(details::statement_impl & st, int & /*position*/)
49  {
50  v_.uppercase_column_names(st.session_.get_uppercase_column_names());
51 
52  convert_to_base();
53  st.bind(v_);
54  }
55 
56  virtual void post_use(bool /*gotData*/)
57  {
58  v_.reset_get_counter();
59  convert_from_base();
60  }
61 
62  virtual void pre_use() {convert_to_base();}
63  virtual void clean_up() {v_.clean_up();}
64  virtual std::size_t size() const { return 1; }
65 
66  // these are used only to re-dispatch to derived class
67  // (the derived class might be generated automatically by
68  // user conversions)
69  virtual void convert_to_base() {}
70  virtual void convert_from_base() {}
71 
72 private:
74 };
75 
76 // this is not supposed to be used - no support for bulk ORM
77 template <>
78 class use_type<std::vector<values> >
79 {
80 private:
81  use_type();
82 };
83 
84 template <>
85 class into_type<values> : public into_type<row>
86 {
87 public:
89  : into_type<row>(v.get_row()), v_(v)
90  {}
91 
93  : into_type<row>(v.get_row(), ind), v_(v)
94  {}
95 
96  void clean_up()
97  {
98  v_.clean_up();
99  }
100 
101 private:
103 };
104 
105 // this is not supposed to be used - no support for bulk ORM
106 template <>
107 class into_type<std::vector<values> >
108 {
109 private:
110  into_type();
111 };
112 
113 } // namespace details
114 
115 } // namespace soci
116 
117 #endif // SOCI_VALUES_EXCHANGE_H_INCLUDED
use_type(values &v, indicator, std::string const &=std::string())
virtual std::size_t size() const
Definition: row.h:41
use_type(values &v, std::string const &=std::string())
virtual void bind(details::statement_impl &st, int &)
bool get_uppercase_column_names() const
into_type(values &v, indicator &ind)


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