Commit 7591c3d4 authored by Mateusz Loskot's avatar Mateusz Loskot

Explicitly mark ref_counted_statement_base and standard_into_type_backend as noncopyable types.

parent 305bca8b
......@@ -30,22 +30,24 @@ class into_type_base;
class ref_counted_prepare_info : public ref_counted_statement_base
{
public:
ref_counted_prepare_info(session & s)
: ref_counted_statement_base(s), session_(s) {}
ref_counted_prepare_info(session& s)
: ref_counted_statement_base(s)
, session_(s)
{}
void exchange(into_type_ptr const & i);
void exchange(use_type_ptr const & u);
void exchange(into_type_ptr const& i);
void exchange(use_type_ptr const& u);
virtual void final_action();
void final_action();
private:
friend class statement_impl;
friend class procedure_impl;
session & session_;
session& session_;
std::vector<into_type_base *> intos_;
std::vector<use_type_base *> uses_;
std::vector<into_type_base*> intos_;
std::vector<use_type_base*> uses_;
std::string get_query() const;
};
......
......@@ -12,6 +12,12 @@
using namespace soci;
using namespace soci::details;
ref_counted_statement_base::ref_counted_statement_base(session& s)
: refCount_(1)
, session_(s)
{
}
void ref_counted_statement::final_action()
{
try
......@@ -32,7 +38,7 @@ void ref_counted_statement::final_action()
st_.clean_up();
}
std::ostringstream & ref_counted_statement_base::get_query_stream()
std::ostringstream& ref_counted_statement_base::get_query_stream()
{
return session_.get_query_stream();
}
......@@ -24,7 +24,8 @@ namespace details
class SOCI_DECL ref_counted_statement_base
{
public:
ref_counted_statement_base(session & s) : refCount_(1), session_(s) {}
ref_counted_statement_base(session& s);
virtual ~ref_counted_statement_base() {}
virtual void final_action() = 0;
......@@ -52,9 +53,6 @@ public:
void accumulate(T const & t) { get_query_stream() << t; }
protected:
ref_counted_statement_base(ref_counted_statement_base const &);
ref_counted_statement_base & operator=(ref_counted_statement_base const &);
// this function allows to break the circular dependenc
// between session and this class
std::ostringstream & get_query_stream();
......@@ -62,6 +60,11 @@ protected:
int refCount_;
session & session_;
private:
// noncopyable
ref_counted_statement_base(ref_counted_statement_base const&);
ref_counted_statement_base& operator=(ref_counted_statement_base const&);
};
// this class is supposed to be a vehicle for the "once" statements
......
......@@ -46,6 +46,7 @@ enum statement_type { st_one_time_query, st_repeatable_query };
class standard_into_type_backend
{
public:
standard_into_type_backend() {}
virtual ~standard_into_type_backend() {}
virtual void define_by_pos(int& position, void* data, exchange_type type) = 0;
......@@ -54,11 +55,17 @@ public:
virtual void post_fetch(bool gotData, bool calledFromFetch, indicator* ind) = 0;
virtual void clean_up() = 0;
private:
// noncopyable
standard_into_type_backend(standard_into_type_backend const&);
standard_into_type_backend& operator=(standard_into_type_backend const&);
};
class vector_into_type_backend
{
public:
virtual ~vector_into_type_backend() {}
virtual void define_by_pos(int& position, void* data, exchange_type type) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment