container-statements.hxx   container-statements.hxx 
skipping to change at line 27 skipping to change at line 27
#include <odb/sqlite/binding.hxx> #include <odb/sqlite/binding.hxx>
#include <odb/sqlite/statement.hxx> #include <odb/sqlite/statement.hxx>
#include <odb/sqlite/details/export.hxx> #include <odb/sqlite/details/export.hxx>
namespace odb namespace odb
{ {
namespace sqlite namespace sqlite
{ {
class connection; class connection;
// Template argument is the generated container traits type. // Template argument is the generated abstract container traits type.
// That is, it doesn't need to provide column counts and statements.
// //
template <typename T> template <typename T>
class container_statements class container_statements
{ {
public: public:
typedef T traits; typedef T traits;
typedef typename traits::id_image_type id_image_type;
typedef typename traits::data_image_type data_image_type; typedef typename traits::data_image_type data_image_type;
typedef typename traits::cond_image_type cond_image_type; typedef typename traits::cond_image_type cond_image_type;
typedef typename traits::functions_type functions_type; typedef typename traits::functions_type functions_type;
typedef sqlite::insert_statement insert_statement_type; typedef sqlite::insert_statement insert_statement_type;
typedef sqlite::select_statement select_statement_type; typedef sqlite::select_statement select_statement_type;
typedef sqlite::delete_statement delete_statement_type; typedef sqlite::delete_statement delete_statement_type;
typedef sqlite::connection connection_type; typedef sqlite::connection connection_type;
skipping to change at line 63 skipping to change at line 63
} }
// Functions. // Functions.
// //
functions_type& functions_type&
functions () functions ()
{ {
return functions_; return functions_;
} }
// Id image (external). // Id image binding (external).
// //
id_image_type& const binding&
id_image () id_binding ()
{ {
return *id_image_; return *id_binding_;
} }
void void
id_image (id_image_type& i) id_binding (const binding& b)
{ {
id_image_ = &i; id_binding_ = &b;
} }
// Condition image. // Condition image.
// //
cond_image_type& cond_image_type&
cond_image () cond_image ()
{ {
return cond_image_; return cond_image_;
} }
std::size_t std::size_t
cond_image_version () const cond_image_version () const
{ {
return cond_image_version_; return cond_image_version_;
} }
void void
cond_image_version (std::size_t v) cond_image_version (std::size_t v)
{ {
cond_image_version_ = v; cond_image_version_ = v;
} }
std::size_t std::size_t
cond_id_image_version () const cond_id_binding_version () const
{ {
return cond_id_image_version_; return cond_id_binding_version_;
} }
void void
cond_id_image_version (std::size_t v) cond_id_binding_version (std::size_t v)
{ {
cond_id_image_version_ = v; cond_id_binding_version_ = v;
} }
binding& binding&
cond_image_binding () cond_image_binding ()
{ {
return cond_image_binding_; return cond_image_binding_;
} }
// Data image. // Data image.
// //
skipping to change at line 136 skipping to change at line 136
return data_image_version_; return data_image_version_;
} }
void void
data_image_version (std::size_t v) data_image_version (std::size_t v)
{ {
data_image_version_ = v; data_image_version_ = v;
} }
std::size_t std::size_t
data_id_image_version () const data_id_binding_version () const
{ {
return data_id_image_version_; return data_id_binding_version_;
} }
void void
data_id_image_version (std::size_t v) data_id_binding_version (std::size_t v)
{ {
data_id_image_version_ = v; data_id_binding_version_ = v;
} }
binding& binding&
data_image_binding () data_image_binding ()
{ {
return data_image_binding_; return data_image_binding_;
} }
bool* bool*
data_image_truncated () data_image_truncated ()
skipping to change at line 170 skipping to change at line 170
// Statements. // Statements.
// //
insert_statement_type& insert_statement_type&
insert_one_statement () insert_one_statement ()
{ {
if (insert_one_ == 0) if (insert_one_ == 0)
{ {
insert_one_.reset ( insert_one_.reset (
new (details::shared) insert_statement_type ( new (details::shared) insert_statement_type (
conn_, traits::insert_one_statement, data_image_binding_)); conn_, insert_one_text_, data_image_binding_));
insert_one_->cached (true); insert_one_->cached (true);
} }
return *insert_one_; return *insert_one_;
} }
select_statement_type& select_statement_type&
select_all_statement () select_all_statement ()
{ {
if (select_all_ == 0) if (select_all_ == 0)
{ {
select_all_.reset ( select_all_.reset (
new (details::shared) select_statement_type ( new (details::shared) select_statement_type (
conn_, conn_,
traits::select_all_statement, select_all_text_,
cond_image_binding_, cond_image_binding_,
data_image_binding_)); data_image_binding_));
select_all_->cached (true); select_all_->cached (true);
} }
return *select_all_; return *select_all_;
} }
delete_statement_type& delete_statement_type&
delete_all_statement () delete_all_statement ()
{ {
if (delete_all_ == 0) if (delete_all_ == 0)
{ {
delete_all_.reset ( delete_all_.reset (
new (details::shared) delete_statement_type ( new (details::shared) delete_statement_type (
conn_, traits::delete_all_statement, cond_image_binding_)); conn_, delete_all_text_, cond_image_binding_));
delete_all_->cached (true); delete_all_->cached (true);
} }
return *delete_all_; return *delete_all_;
} }
private: private:
container_statements (const container_statements&); container_statements (const container_statements&);
container_statements& operator= (const container_statements&); container_statements& operator= (const container_statements&);
private: protected:
connection_type& conn_; connection_type& conn_;
functions_type functions_; functions_type functions_;
id_image_type* id_image_; const binding* id_binding_;
cond_image_type cond_image_; cond_image_type cond_image_;
std::size_t cond_image_version_; std::size_t cond_image_version_;
std::size_t cond_id_image_version_; std::size_t cond_id_binding_version_;
binding cond_image_binding_; binding cond_image_binding_;
bind cond_image_bind_[traits::cond_column_count]; bind* cond_image_bind_;
data_image_type data_image_; data_image_type data_image_;
std::size_t data_image_version_; std::size_t data_image_version_;
std::size_t data_id_image_version_; std::size_t data_id_binding_version_;
binding data_image_binding_; binding data_image_binding_;
bind data_image_bind_[traits::data_column_count]; bind* data_image_bind_;
bool data_image_truncated_[traits::data_column_count]; bool* data_image_truncated_;
const char* insert_one_text_;
const char* select_all_text_;
const char* delete_all_text_;
details::shared_ptr<insert_statement_type> insert_one_; details::shared_ptr<insert_statement_type> insert_one_;
details::shared_ptr<select_statement_type> select_all_; details::shared_ptr<select_statement_type> select_all_;
details::shared_ptr<delete_statement_type> delete_all_; details::shared_ptr<delete_statement_type> delete_all_;
}; };
// Template argument is the generated concrete container traits type.
//
template <typename T>
class container_statements_impl: public T::statements_type
{
public:
typedef T traits;
typedef typename T::statements_type base;
typedef sqlite::connection connection_type;
container_statements_impl (connection_type&);
private:
container_statements_impl (const container_statements_impl&);
container_statements_impl& operator= (const container_statements_impl
&);
private:
bind cond_image_bind_array_[traits::cond_column_count];
bind data_image_bind_array_[traits::data_column_count];
bool data_image_truncated_array_[traits::data_column_count];
};
} }
} }
#include <odb/sqlite/container-statements.txx> #include <odb/sqlite/container-statements.txx>
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_SQLITE_CONTAINER_STATEMENTS_HXX #endif // ODB_SQLITE_CONTAINER_STATEMENTS_HXX
 End of changes. 26 change blocks. 
27 lines changed or deleted 54 lines changed or added


 container-statements.txx   container-statements.txx 
skipping to change at line 24 skipping to change at line 24
// //
template <typename T> template <typename T>
container_statements<T>:: container_statements<T>::
container_statements (connection_type& conn) container_statements (connection_type& conn)
: conn_ (conn), : conn_ (conn),
functions_ (this, functions_ (this,
&traits::insert_one, &traits::insert_one,
&traits::load_all, &traits::load_all,
&traits::delete_all), &traits::delete_all),
id_image_ (0), id_binding_ (0),
cond_image_binding_ (cond_image_bind_, traits::cond_column_count) cond_image_binding_ (0, 0), // Initialized by impl.
, data_image_binding_ (0, 0) // Initialized by impl.
data_image_binding_ (data_image_bind_, traits::data_column_count)
{ {
cond_image_.version = 0; cond_image_.version = 0;
cond_image_version_ = 0; cond_image_version_ = 0;
cond_id_image_version_ = 0; cond_id_binding_version_ = 0;
data_image_.version = 0; data_image_.version = 0;
data_image_version_ = 0; data_image_version_ = 0;
data_id_image_version_ = 0; data_id_binding_version_ = 0;
}
template <typename T>
container_statements_impl<T>::
container_statements_impl (connection_type& conn)
: base (conn)
{
this->cond_image_bind_ = cond_image_bind_array_;
this->data_image_bind_ = data_image_bind_array_;
this->data_image_truncated_ = data_image_truncated_array_;
std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_)); this->cond_image_binding_.bind = this->cond_image_bind_;
std::memset (data_image_bind_, 0, sizeof (data_image_bind_)); this->cond_image_binding_.count = traits::cond_column_count;
std::memset (data_image_truncated_, 0, sizeof (data_image_truncated_)
); this->data_image_binding_.bind = this->data_image_bind_;
this->data_image_binding_.count = traits::data_column_count;
std::memset (cond_image_bind_array_, 0, sizeof (cond_image_bind_array
_));
std::memset (data_image_bind_array_, 0, sizeof (data_image_bind_array
_));
std::memset (data_image_truncated_array_,
0,
sizeof (data_image_truncated_array_));
for (std::size_t i (0); i < traits::data_column_count; ++i) for (std::size_t i (0); i < traits::data_column_count; ++i)
data_image_bind_[i].truncated = data_image_truncated_ + i; data_image_bind_array_[i].truncated = data_image_truncated_array_ +
i;
this->insert_one_text_ = traits::insert_one_statement;
this->select_all_text_ = traits::select_all_statement;
this->delete_all_text_ = traits::delete_all_statement;
} }
} }
} }
 End of changes. 5 change blocks. 
11 lines changed or deleted 34 lines changed or added


 forward.hxx   forward.hxx 
skipping to change at line 25 skipping to change at line 25
namespace sqlite namespace sqlite
{ {
class database; class database;
class connection; class connection;
class connection_factory; class connection_factory;
class transaction; class transaction;
class query; class query;
// Implementation details. // Implementation details.
// //
class binding;
class select_statement; class select_statement;
template <typename T> template <typename T>
class object_statements; class object_statements;
template <typename T> template <typename T>
class container_statements; class container_statements;
class query_params; class query_params;
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 query.hxx   query.hxx 
skipping to change at line 1062 skipping to change at line 1062
{ {
b->type = sqlite::bind::integer; b->type = sqlite::bind::integer;
b->buffer = &image_; b->buffer = &image_;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool dummy;
value_traits<T, long long, id_integer>::set_image (image_, dummy, v ); value_traits<T, id_integer>::set_image (image_, dummy, v);
} }
private: private:
long long image_; long long image_;
}; };
// REAL // REAL
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_real>: query_param struct query_param_impl<T, id_real>: query_param
skipping to change at line 1096 skipping to change at line 1096
{ {
b->type = sqlite::bind::real; b->type = sqlite::bind::real;
b->buffer = &image_; b->buffer = &image_;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool dummy;
value_traits<T, double, id_real>::set_image (image_, dummy, v); value_traits<T, id_real>::set_image (image_, dummy, v);
} }
private: private:
double image_; double image_;
}; };
// TEXT // TEXT
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_text>: query_param struct query_param_impl<T, id_text>: query_param
skipping to change at line 1131 skipping to change at line 1131
b->buffer = buffer_.data (); b->buffer = buffer_.data ();
b->size = &size_; b->size = &size_;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool dummy;
std::size_t cap (buffer_.capacity ()); std::size_t cap (buffer_.capacity ());
value_traits<T, details::buffer, id_text>::set_image ( value_traits<T, id_text>::set_image (buffer_, size_, dummy, v);
buffer_, size_, dummy, v);
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::buffer buffer_; details::buffer buffer_;
std::size_t size_; std::size_t size_;
}; };
// BLOB // BLOB
// //
skipping to change at line 1169 skipping to change at line 1168
b->buffer = buffer_.data (); b->buffer = buffer_.data ();
b->size = &size_; b->size = &size_;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool dummy;
std::size_t cap (buffer_.capacity ()); std::size_t cap (buffer_.capacity ());
value_traits<T, details::buffer, id_blob>::set_image ( value_traits<T, id_blob>::set_image (buffer_, size_, dummy, v);
buffer_, size_, dummy, v);
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::buffer buffer_; details::buffer buffer_;
std::size_t size_; std::size_t size_;
}; };
} }
} }
 End of changes. 4 change blocks. 
6 lines changed or deleted 4 lines changed or added


 result.txx   result.txx 
skipping to change at line 40 skipping to change at line 40
void result_impl<T>:: void result_impl<T>::
load (object_type& obj) load (object_type& obj)
{ {
load_image (); load_image ();
// This is a top-level call so the statements cannot be locked. // This is a top-level call so the statements cannot be locked.
// //
assert (!statements_.locked ()); assert (!statements_.locked ());
typename object_statements<object_type>::auto_lock l (statements_); typename object_statements<object_type>::auto_lock l (statements_);
typename object_traits::image_type& im (statements_.image ()); typename object_traits::image_type& i (statements_.image ());
object_traits::init (obj, im, this->database ()); object_traits::init (obj, i, this->database ());
// Initialize the id image and load the rest of the object // Initialize the id image and binding and load the rest of the objec t
// (containers, etc). // (containers, etc).
// //
object_traits::init (statements_.id_image (), object_traits::id (im)) typename object_traits::id_image_type& idi (statements_.id_image ());
; object_traits::init (idi, object_traits::id (i));
binding& idb (statements_.id_image_binding ());
if (idi.version != statements_.id_image_version () || idb.version ==
0)
{
object_traits::bind (idb.bind, idi);
statements_.id_image_version (idi.version);
idb.version++;
}
object_traits::load_ (statements_, obj); object_traits::load_ (statements_, obj);
statements_.load_delayed (); statements_.load_delayed ();
l.unlock (); l.unlock ();
} }
template <typename T> template <typename T>
typename result_impl<T>::id_type result_impl<T>:: typename result_impl<T>::id_type result_impl<T>::
load_id () load_id ()
{ {
skipping to change at line 92 skipping to change at line 102
binding& b (statements_.out_image_binding ()); binding& b (statements_.out_image_binding ());
object_traits::bind (b.bind, im, true); object_traits::bind (b.bind, im, true);
statements_.out_image_version (im.version); statements_.out_image_version (im.version);
b.version++; b.version++;
} }
select_statement::result r (statement_->load ()); select_statement::result r (statement_->load ());
if (r == select_statement::truncated) if (r == select_statement::truncated)
{ {
object_traits::grow (im, statements_.out_image_truncated ()); if (object_traits::grow (im, statements_.out_image_truncated ()))
im.version++;
if (im.version != statements_.out_image_version ()) if (im.version != statements_.out_image_version ())
{ {
binding& b (statements_.out_image_binding ()); binding& b (statements_.out_image_binding ());
object_traits::bind (b.bind, im, true); object_traits::bind (b.bind, im, true);
statements_.out_image_version (im.version); statements_.out_image_version (im.version);
b.version++; b.version++;
statement_->reload (); statement_->reload ();
} }
} }
 End of changes. 4 change blocks. 
6 lines changed or deleted 17 lines changed or added


 traits.hxx   traits.hxx 
skipping to change at line 33 skipping to change at line 33
{ {
enum database_type_id enum database_type_id
{ {
id_integer, id_integer,
id_real, id_real,
id_text, id_text,
id_blob id_blob
}; };
// //
// image_traits
//
template <database_type_id>
struct image_traits;
template <>
struct image_traits<id_integer> {typedef long long image_type;};
template <>
struct image_traits<id_real> {typedef double image_type;};
template <>
struct image_traits<id_text> {typedef details::buffer image_type;};
template <>
struct image_traits<id_blob> {typedef details::buffer image_type;};
//
// value_traits // value_traits
// //
template <typename T, typename I, database_type_id> template <typename T, database_type_id>
struct default_value_traits; struct default_value_traits;
template <typename T, typename I, database_type_id ID> template <typename T, database_type_id ID>
class value_traits: public default_value_traits<T, I, ID> class value_traits: public default_value_traits<T, ID>
{ {
}; };
template <typename T, typename I, database_type_id> template <typename T, database_type_id ID>
struct default_value_traits struct default_value_traits
{ {
typedef T value_type; typedef T value_type;
typedef T query_type; typedef T query_type;
typedef I image_type; typedef typename image_traits<ID>::image_type image_type;
static void static void
set_value (T& v, I i, bool is_null) set_value (T& v, const image_type& i, bool is_null)
{ {
if (!is_null) if (!is_null)
v = T (i); v = T (i);
else else
v = T (); v = T ();
} }
static void static void
set_image (I& i, bool& is_null, T v) set_image (image_type& i, bool& is_null, T v)
{ {
is_null = false; is_null = false;
i = I (v); i = image_type (v);
} }
}; };
// std::string specialization. // std::string specialization.
// //
template <> template <>
struct LIBODB_SQLITE_EXPORT default_value_traits< struct LIBODB_SQLITE_EXPORT default_value_traits<std::string, id_text>
std::string, details::buffer, id_text>
{ {
typedef std::string value_type; typedef std::string value_type;
typedef std::string query_type; typedef std::string query_type;
typedef details::buffer image_type; typedef details::buffer image_type;
static void static void
set_value (std::string& v, set_value (std::string& v,
const details::buffer& b, const details::buffer& b,
std::size_t n, std::size_t n,
bool is_null) bool is_null)
skipping to change at line 104 skipping to change at line 122
const std::string&); const std::string&);
}; };
// const char* specialization // const char* specialization
// //
// Specialization for const char* which only supports initialization // Specialization for const char* which only supports initialization
// of an image from the value but not the other way around. This way // of an image from the value but not the other way around. This way
// we can pass such values to the queries. // we can pass such values to the queries.
// //
template <> template <>
struct LIBODB_SQLITE_EXPORT default_value_traits< struct LIBODB_SQLITE_EXPORT default_value_traits<const char*, id_text>
const char*, details::buffer, id_text>
{ {
typedef const char* value_type; typedef const char* value_type;
typedef const char* query_type; typedef const char* query_type;
typedef details::buffer image_type; typedef details::buffer image_type;
static void static void
set_image (details::buffer&, set_image (details::buffer&,
std::size_t& n, std::size_t& n,
bool& is_null, bool& is_null,
const char*); const char*);
 End of changes. 10 change blocks. 
12 lines changed or deleted 29 lines changed or added


 version.hxx   version.hxx 
skipping to change at line 32 skipping to change at line 32
// Version AABBCCDD // Version AABBCCDD
// 2.0.0 02000000 // 2.0.0 02000000
// 2.1.0 02010000 // 2.1.0 02010000
// 2.1.1 02010100 // 2.1.1 02010100
// 2.2.0.a1 02019901 // 2.2.0.a1 02019901
// 3.0.0.b2 02999952 // 3.0.0.b2 02999952
// //
// Check that we have compatible ODB version. // Check that we have compatible ODB version.
// //
#if ODB_VERSION != 10300 #if ODB_VERSION != 10400
# error incompatible odb interface version detected # error incompatible odb interface version detected
#endif #endif
// libodb-sqlite version: odb interface version plus the bugfix // libodb-sqlite version: odb interface version plus the bugfix
// version. // version.
// //
#define LIBODB_SQLITE_VERSION 1030000 #define LIBODB_SQLITE_VERSION 1040000
#define LIBODB_SQLITE_VERSION_STR "1.3.0" #define LIBODB_SQLITE_VERSION_STR "1.4.0"
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_SQLITE_VERSION_HXX #endif // ODB_SQLITE_VERSION_HXX
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/