use-type.cpp
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 #define SOCI_SOURCE
9 #include "use-type.h"
10 #include "statement.h"
11 
12 using namespace soci;
13 using namespace soci::details;
14 
16 {
17  delete backEnd_;
18 }
19 
20 void standard_use_type::bind(statement_impl & st, int & position)
21 {
22  if (backEnd_ == NULL)
23  {
25  }
26  if (name_.empty())
27  {
29  }
30  else
31  {
33  }
34 }
35 
37 {
38  // Handle IN direction of parameters of SQL statements and procedures
41 }
42 
43 void standard_use_type::post_use(bool gotData)
44 {
45  // Handle OUT direction of IN/OUT parameters of stored procedures
46  backEnd_->post_use(gotData, ind_);
48 
49  // IMPORTANT:
50  // This treatment of input ("use") parameter as output data sink may be
51  // confusing, but it is necessary to store OUT data back in the same
52  // object as IN, of IN/OUT parameter.
53  // As there is no symmetry for IN/OUT in SQL and there are no OUT/IN
54  // we do not perform convert_to_base() for output ("into") parameter.
55  // See conversion_use_type<T>::convert_from_base() for more details.
56 }
57 
59 {
60  if (backEnd_ != NULL)
61  {
62  backEnd_->clean_up();
63  }
64 }
65 
67 {
68  delete backEnd_;
69 }
70 
71 void vector_use_type::bind(statement_impl & st, int & position)
72 {
73  if (backEnd_ == NULL)
74  {
76  }
77  if (name_.empty())
78  {
79  backEnd_->bind_by_pos(position, data_, type_);
80  }
81  else
82  {
84  }
85 }
86 
88 {
90 
91  backEnd_->pre_use(ind_ ? &ind_->at(0) : NULL);
92 }
93 
94 std::size_t vector_use_type::size() const
95 {
96  return backEnd_->size();
97 }
98 
100 {
101  if (backEnd_ != NULL)
102  {
103  backEnd_->clean_up();
104  }
105 }
standard_use_type_backend * make_use_type_backend()
virtual void bind_by_pos(int &position, void *data, exchange_type type, bool readOnly)=0
virtual void post_use(bool gotData, indicator *ind)=0
vector_use_type_backend * make_vector_use_type_backend()
virtual std::size_t size() const
Definition: use-type.cpp:94
standard_use_type_backend * backEnd_
Definition: use-type.h:94
virtual void bind(statement_impl &st, int &position)
Definition: use-type.cpp:20
virtual void convert_to_base()
Definition: use-type.h:77
virtual void bind(statement_impl &st, int &position)
Definition: use-type.cpp:71
virtual void bind_by_name(std::string const &name, void *data, exchange_type type, bool readOnly)=0
virtual void pre_use(indicator const *ind)=0
virtual void convert_from_base()
Definition: use-type.h:78
virtual void post_use(bool gotData)
Definition: use-type.cpp:43


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