session.h | session.h | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
#ifndef SOCI_SESSION_H_INCLUDED | #ifndef SOCI_SESSION_H_INCLUDED | |||
#define SOCI_SESSION_H_INCLUDED | #define SOCI_SESSION_H_INCLUDED | |||
#include "once-temp-type.h" | #include "once-temp-type.h" | |||
#include "query_transformation.h" | #include "query_transformation.h" | |||
#include "connection-parameters.h" | #include "connection-parameters.h" | |||
// std | // std | |||
#include <cstddef> | #include <cstddef> | |||
#include <memory> | ||||
#include <ostream> | #include <ostream> | |||
#include <sstream> | #include <sstream> | |||
#include <string> | #include <string> | |||
namespace soci | namespace soci | |||
{ | { | |||
class values; | class values; | |||
class backend_factory; | class backend_factory; | |||
namespace details | namespace details | |||
skipping to change at line 40 | skipping to change at line 41 | |||
class statement_backend; | class statement_backend; | |||
class rowid_backend; | class rowid_backend; | |||
class blob_backend; | class blob_backend; | |||
} // namespace details | } // namespace details | |||
class connection_pool; | class connection_pool; | |||
class SOCI_DECL session | class SOCI_DECL session | |||
{ | { | |||
private: | ||||
void set_query_transformation_(std::auto_ptr<details::query_transformat | ||||
ion_function> qtf); | ||||
public: | public: | |||
session(); | session(); | |||
explicit session(connection_parameters const & parameters); | explicit session(connection_parameters const & parameters); | |||
session(backend_factory const & factory, std::string const & connectStr ing); | session(backend_factory const & factory, std::string const & connectStr ing); | |||
session(std::string const & backendName, std::string const & connectStr ing); | session(std::string const & backendName, std::string const & connectStr ing); | |||
explicit session(std::string const & connectString); | explicit session(std::string const & connectString); | |||
explicit session(connection_pool & pool); | explicit session(connection_pool & pool); | |||
~session(); | ~session(); | |||
skipping to change at line 75 | skipping to change at line 80 | |||
// even more sugar | // even more sugar | |||
template <typename T> | template <typename T> | |||
details::once_temp_type operator<<(T const & t) { return once << t; } | details::once_temp_type operator<<(T const & t) { return once << t; } | |||
std::ostringstream & get_query_stream(); | std::ostringstream & get_query_stream(); | |||
std::string get_query() const; | std::string get_query() const; | |||
template <typename T> | template <typename T> | |||
void set_query_transformation(T callback) | void set_query_transformation(T callback) | |||
{ | { | |||
delete query_transformation_; | std::auto_ptr<details::query_transformation_function> qtf(new detai | |||
query_transformation_= new details::query_transformation<T>(callbac | ls::query_transformation<T>(callback)); | |||
k); | set_query_transformation_(qtf); | |||
assert(qtf.get() == NULL); | ||||
} | } | |||
// support for basic logging | // support for basic logging | |||
void set_log_stream(std::ostream * s); | void set_log_stream(std::ostream * s); | |||
std::ostream * get_log_stream() const; | std::ostream * get_log_stream() const; | |||
void log_query(std::string const & query); | void log_query(std::string const & query); | |||
std::string get_last_query() const; | std::string get_last_query() const; | |||
void set_got_data(bool gotData); | void set_got_data(bool gotData); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 11 lines changed or added | |||
values-exchange.h | values-exchange.h | |||
---|---|---|---|---|
skipping to change at line 62 | skipping to change at line 62 | |||
convert_to_base(); | convert_to_base(); | |||
st.bind(v_); | st.bind(v_); | |||
} | } | |||
virtual void post_use(bool /*gotData*/) | virtual void post_use(bool /*gotData*/) | |||
{ | { | |||
v_.reset_get_counter(); | v_.reset_get_counter(); | |||
convert_from_base(); | convert_from_base(); | |||
} | } | |||
virtual void pre_use() {} | virtual void pre_use() {convert_to_base();} | |||
virtual void clean_up() {v_.clean_up();} | virtual void clean_up() {v_.clean_up();} | |||
virtual std::size_t size() const { return 1; } | virtual std::size_t size() const { return 1; } | |||
// these are used only to re-dispatch to derived class | // these are used only to re-dispatch to derived class | |||
// (the derived class might be generated automatically by | // (the derived class might be generated automatically by | |||
// user conversions) | // user conversions) | |||
virtual void convert_to_base() {} | virtual void convert_to_base() {} | |||
virtual void convert_from_base() {} | virtual void convert_from_base() {} | |||
private: | private: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
values.h | values.h | |||
---|---|---|---|---|
skipping to change at line 168 | skipping to change at line 168 | |||
} | } | |||
else | else | |||
{ | { | |||
currentPos_ = 0; | currentPos_ = 0; | |||
} | } | |||
} | } | |||
template <typename T> | template <typename T> | |||
void set(std::string const & name, T const & value, indicator indic = i _ok) | void set(std::string const & name, T const & value, indicator indic = i _ok) | |||
{ | { | |||
index_.insert(std::make_pair(name, uses_.size())); | ||||
indicator * pind = new indicator(indic); | ||||
indicators_.push_back(pind); | ||||
typedef typename type_conversion<T>::base_type base_type; | typedef typename type_conversion<T>::base_type base_type; | |||
base_type baseValue; | if(index_.find(name) == index_.end()) | |||
if (indic == i_ok) | ||||
{ | { | |||
type_conversion<T>::to_base(value, baseValue, *pind); | index_.insert(std::make_pair(name, uses_.size())); | |||
} | ||||
details::copy_holder<base_type> * pcopy = | indicator * pind = new indicator(indic); | |||
new details::copy_holder<base_type>(baseValue); | indicators_.push_back(pind); | |||
deepCopies_.push_back(pcopy); | ||||
uses_.push_back(new details::use_type<base_type>( | base_type baseValue; | |||
pcopy->value_, *pind, name)); | if (indic == i_ok) | |||
{ | ||||
type_conversion<T>::to_base(value, baseValue, *pind); | ||||
} | ||||
details::copy_holder<base_type> * pcopy = | ||||
new details::copy_holder<base_type>(baseValue); | ||||
deepCopies_.push_back(pcopy); | ||||
uses_.push_back(new details::use_type<base_type>( | ||||
pcopy->value_, *pind, name)); | ||||
} | ||||
else | ||||
{ | ||||
size_t index = index_.find(name)->second; | ||||
*indicators_[index] = indic; | ||||
if (indic == i_ok) | ||||
{ | ||||
type_conversion<T>::to_base( | ||||
value, | ||||
static_cast<details::copy_holder<base_type>*>(deepC | ||||
opies_[index])->value_, | ||||
*indicators_[index]); | ||||
} | ||||
} | ||||
} | } | |||
template <typename T> | template <typename T> | |||
void set(const T & value, indicator indic = i_ok) | void set(const T & value, indicator indic = i_ok) | |||
{ | { | |||
indicator * pind = new indicator(indic); | indicator * pind = new indicator(indic); | |||
indicators_.push_back(pind); | indicators_.push_back(pind); | |||
typedef typename type_conversion<T>::base_type base_type; | typedef typename type_conversion<T>::base_type base_type; | |||
base_type baseValue; | base_type baseValue; | |||
End of changes. 5 change blocks. | ||||
14 lines changed or deleted | 30 lines changed or added | |||
version.h | version.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
// | // | |||
// Caution, this is the only SOCI header that is guarenteed | // Caution, this is the only SOCI header that is guarenteed | |||
// to change with every SOCI release, including this header | // to change with every SOCI release, including this header | |||
// will cause a recompile every time a new SOCI version is | // will cause a recompile every time a new SOCI version is | |||
// released. | // released. | |||
// | // | |||
// SOCI_VERSION % 100 is the patch level | // SOCI_VERSION % 100 is the patch level | |||
// SOCI_VERSION / 100 % 1000 is the minor version | // SOCI_VERSION / 100 % 1000 is the minor version | |||
// SOCI_VERSION / 100000 is the major version | // SOCI_VERSION / 100000 is the major version | |||
#define SOCI_VERSION 300200 | #define SOCI_VERSION 300201 | |||
// | // | |||
// SOCI_LIB_VERSION must be defined to be the same as SOCI_VERSION | // SOCI_LIB_VERSION must be defined to be the same as SOCI_VERSION | |||
// but as a *string* in the form "x_y[_z]" where x is the major version | // but as a *string* in the form "x_y[_z]" where x is the major version | |||
// number, y is the minor version number, and z is the patch level if not 0. | // number, y is the minor version number, and z is the patch level if not 0. | |||
#define SOCI_LIB_VERSION "3_2_0" | #define SOCI_LIB_VERSION "3_2_1" | |||
#endif // SOCI_VERSION_HPP | #endif // SOCI_VERSION_HPP | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||