procedure.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_PROCEDURE_H_INCLUDED
9 #define SOCI_PROCEDURE_H_INCLUDED
10 
11 #include "statement.h"
12 
13 namespace soci
14 {
15 
16 namespace details
17 {
18 
20 {
21 public:
22  procedure_impl(session & s) : statement_impl(s), refCount_(1) {}
23  procedure_impl(prepare_temp_type const & prep);
24 
25  void inc_ref() { ++refCount_; }
26  void dec_ref()
27  {
28  if (--refCount_ == 0)
29  {
30  delete this;
31  }
32  }
33 
34 private:
35  int refCount_;
36 };
37 
38 } // namespace details
39 
41 {
42 public:
43  // this is a conversion constructor
45  : impl_(new details::procedure_impl(prep)) {}
46 
47  ~procedure() { impl_->dec_ref(); }
48 
49  // copy is supported here
50  procedure(procedure const & other)
51  : impl_(other.impl_)
52  {
53  impl_->inc_ref();
54  }
55  void operator=(procedure const & other)
56  {
57  other.impl_->inc_ref();
58  impl_->dec_ref();
59  impl_ = other.impl_;
60  }
61 
62  // forwarders to procedure_impl
63  // (or rather to its base interface from statement_impl)
64 
65  bool execute(bool withDataExchange = false)
66  {
67  gotData_ = impl_->execute(withDataExchange);
68  return gotData_;
69  }
70 
71  bool fetch()
72  {
73  gotData_ = impl_->fetch();
74  return gotData_;
75  }
76 
77  bool got_data() const
78  {
79  return gotData_;
80  }
81 
82 private:
84  bool gotData_;
85 };
86 
87 } // namespace soci
88 
89 #endif
procedure(details::prepare_temp_type const &prep)
Definition: procedure.h:44
details::procedure_impl * impl_
Definition: procedure.h:83
#define SOCI_DECL
Definition: soci-config.h:31
bool execute(bool withDataExchange=false)
Definition: procedure.h:65
bool fetch()
Definition: procedure.h:71
bool got_data() const
Definition: procedure.h:77
procedure(procedure const &other)
Definition: procedure.h:50
void operator=(procedure const &other)
Definition: procedure.h:55


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