config.h | config.h | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
/* This file is automatically processed by configure. */ | /* This file is automatically processed by configure. */ | |||
#ifndef ODB_MYSQL_DETAILS_CONFIG_H | #ifndef ODB_MYSQL_DETAILS_CONFIG_H | |||
#define ODB_MYSQL_DETAILS_CONFIG_H | #define ODB_MYSQL_DETAILS_CONFIG_H | |||
/* #undef LIBODB_MYSQL_STATIC_LIB */ | /* #undef LIBODB_MYSQL_STATIC_LIB */ | |||
/* #undef LIBODB_MYSQL_INCLUDE_SHORT */ | /* #undef LIBODB_MYSQL_INCLUDE_SHORT */ | |||
#define LIBODB_MYSQL_INCLUDE_LONG 1 | #define LIBODB_MYSQL_INCLUDE_LONG 1 | |||
/* #undef LIBODB_MYSQL_THR_KEY_VISIBLE */ | ||||
#endif /* ODB_MYSQL_DETAILS_CONFIG_H */ | #endif /* ODB_MYSQL_DETAILS_CONFIG_H */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
polymorphic-object-statements.hxx | polymorphic-object-statements.hxx | |||
---|---|---|---|---|
skipping to change at line 351 | skipping to change at line 351 | |||
false)); | false)); | |||
return *erase_; | return *erase_; | |||
} | } | |||
// Container statement cache. | // Container statement cache. | |||
// | // | |||
container_statement_cache_type& | container_statement_cache_type& | |||
container_statment_cache () | container_statment_cache () | |||
{ | { | |||
return container_statement_cache_; | return container_statement_cache_.get (conn_); | |||
} | } | |||
public: | public: | |||
// select = total - id + base::select | // select = total - id + base::select | |||
// insert = total - inverse | // insert = total - inverse | |||
// update = total - inverse - id - readonly | // update = total - inverse - id - readonly | |||
// | // | |||
static const std::size_t id_column_count = | static const std::size_t id_column_count = | |||
object_traits::id_column_count; | object_traits::id_column_count; | |||
skipping to change at line 383 | skipping to change at line 383 | |||
polymorphic_derived_object_statements ( | polymorphic_derived_object_statements ( | |||
const polymorphic_derived_object_statements&); | const polymorphic_derived_object_statements&); | |||
polymorphic_derived_object_statements& | polymorphic_derived_object_statements& | |||
operator= (const polymorphic_derived_object_statements&); | operator= (const polymorphic_derived_object_statements&); | |||
private: | private: | |||
root_statements_type& root_statements_; | root_statements_type& root_statements_; | |||
base_statements_type& base_statements_; | base_statements_type& base_statements_; | |||
container_statement_cache_type container_statement_cache_; | container_statement_cache_ptr<container_statement_cache_type> | |||
container_statement_cache_; | ||||
image_type image_; | image_type image_; | |||
// Select binding. Here we are have an array of statements/bindings | // Select binding. Here we are have an array of statements/bindings | |||
// one for each depth. In other words, if we have classes root, base, | // one for each depth. In other words, if we have classes root, base, | |||
// and derived, then we have the following array of statements: | // and derived, then we have the following array of statements: | |||
// | // | |||
// [0] d + b + r | // [0] d + b + r | |||
// [1] d + b | // [1] d + b | |||
// [2] d | // [2] d | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
polymorphic-object-statements.txx | polymorphic-object-statements.txx | |||
---|---|---|---|---|
skipping to change at line 79 | skipping to change at line 79 | |||
~polymorphic_derived_object_statements () | ~polymorphic_derived_object_statements () | |||
{ | { | |||
} | } | |||
template <typename T> | template <typename T> | |||
polymorphic_derived_object_statements<T>:: | polymorphic_derived_object_statements<T>:: | |||
polymorphic_derived_object_statements (connection_type& conn) | polymorphic_derived_object_statements (connection_type& conn) | |||
: statements_base (conn), | : statements_base (conn), | |||
root_statements_ (conn.statement_cache ().find_object<root_type> ()), | root_statements_ (conn.statement_cache ().find_object<root_type> ()), | |||
base_statements_ (conn.statement_cache ().find_object<base_type> ()), | base_statements_ (conn.statement_cache ().find_object<base_type> ()), | |||
container_statement_cache_ (conn), | ||||
insert_image_binding_ (insert_image_bind_, insert_column_count), | insert_image_binding_ (insert_image_bind_, insert_column_count), | |||
update_image_binding_ (update_image_bind_, | update_image_binding_ (update_image_bind_, | |||
update_column_count + id_column_count) | update_column_count + id_column_count) | |||
{ | { | |||
image_.base = &base_statements_.image (); | image_.base = &base_statements_.image (); | |||
image_.version = 0; | image_.version = 0; | |||
for (std::size_t i (0); i < object_traits::depth; ++i) | for (std::size_t i (0); i < object_traits::depth; ++i) | |||
select_image_versions_[i] = 0; | select_image_versions_[i] = 0; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 0 lines changed or added | |||
simple-object-statements.hxx | simple-object-statements.hxx | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
#include <odb/mysql/binding.hxx> | #include <odb/mysql/binding.hxx> | |||
#include <odb/mysql/statement.hxx> | #include <odb/mysql/statement.hxx> | |||
#include <odb/mysql/statements-base.hxx> | #include <odb/mysql/statements-base.hxx> | |||
#include <odb/mysql/details/export.hxx> | #include <odb/mysql/details/export.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace mysql | namespace mysql | |||
{ | { | |||
// The container_statement_cache class is only defined (and used) in | ||||
// the generated source file. However, object_statements may be | ||||
// referenced from another source file in the case of a polymorphic | ||||
// hierarchy (though in this case the container statement cache is | ||||
// not used). As a result, we cannot have a by-value member and | ||||
// instead will store a pointer and lazily allocate the cache if | ||||
// and when needed. We will also need to store a pointer to the | ||||
// deleter function which will be initialized during allocation | ||||
// (at that point we know that the cache class is defined). | ||||
// | ||||
template <typename T> | ||||
struct container_statement_cache_ptr | ||||
{ | ||||
typedef mysql::connection connection_type; | ||||
container_statement_cache_ptr (): p_ (0) {} | ||||
~container_statement_cache_ptr () {if (p_ != 0) (this->*deleter_) (0) | ||||
;} | ||||
T& | ||||
get (connection_type& c) | ||||
{ | ||||
if (p_ == 0) | ||||
allocate (&c); | ||||
return *p_; | ||||
} | ||||
private: | ||||
void | ||||
allocate (connection_type*); | ||||
private: | ||||
T* p_; | ||||
void (container_statement_cache_ptr::*deleter_) (connection_type*); | ||||
}; | ||||
template <typename T> | ||||
void container_statement_cache_ptr<T>:: | ||||
allocate (connection_type* c) | ||||
{ | ||||
// To reduce object code size, this function acts as both allocator | ||||
// and deleter. | ||||
// | ||||
if (p_ == 0) | ||||
{ | ||||
p_ = new T (*c); | ||||
deleter_ = &container_statement_cache_ptr<T>::allocate; | ||||
} | ||||
else | ||||
delete p_; | ||||
} | ||||
// | // | |||
// Implementation for objects with object id. | // Implementation for objects with object id. | |||
// | // | |||
class LIBODB_MYSQL_EXPORT object_statements_base: public statements_bas e | class LIBODB_MYSQL_EXPORT object_statements_base: public statements_bas e | |||
{ | { | |||
// Locking. | // Locking. | |||
// | // | |||
public: | public: | |||
void | void | |||
skipping to change at line 363 | skipping to change at line 415 | |||
} | } | |||
return *od_.erase_; | return *od_.erase_; | |||
} | } | |||
// Container statement cache. | // Container statement cache. | |||
// | // | |||
container_statement_cache_type& | container_statement_cache_type& | |||
container_statment_cache () | container_statment_cache () | |||
{ | { | |||
return container_statement_cache_; | return container_statement_cache_.get (conn_); | |||
} | } | |||
public: | public: | |||
// select = total | // select = total | |||
// insert = total - inverse - managed_optimistic | // insert = total - inverse - managed_optimistic | |||
// update = total - inverse - managed_optimistic - id - readonly | // update = total - inverse - managed_optimistic - id - readonly | |||
// | // | |||
static const std::size_t select_column_count = | static const std::size_t select_column_count = | |||
object_traits::column_count; | object_traits::column_count; | |||
skipping to change at line 399 | skipping to change at line 451 | |||
object_statements& operator= (const object_statements&); | object_statements& operator= (const object_statements&); | |||
private: | private: | |||
void | void | |||
load_delayed_ (); | load_delayed_ (); | |||
void | void | |||
clear_delayed_ (); | clear_delayed_ (); | |||
private: | private: | |||
container_statement_cache_type container_statement_cache_; | container_statement_cache_ptr<container_statement_cache_type> | |||
container_statement_cache_; | ||||
image_type image_; | image_type image_; | |||
// Select binding. | // Select binding. | |||
// | // | |||
std::size_t select_image_version_; | std::size_t select_image_version_; | |||
binding select_image_binding_; | binding select_image_binding_; | |||
MYSQL_BIND select_image_bind_[select_column_count]; | MYSQL_BIND select_image_bind_[select_column_count]; | |||
my_bool select_image_truncated_[select_column_count]; | my_bool select_image_truncated_[select_column_count]; | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 56 lines changed or added | |||
simple-object-statements.txx | simple-object-statements.txx | |||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
template <typename T> | template <typename T> | |||
object_statements<T>:: | object_statements<T>:: | |||
~object_statements () | ~object_statements () | |||
{ | { | |||
} | } | |||
template <typename T> | template <typename T> | |||
object_statements<T>:: | object_statements<T>:: | |||
object_statements (connection_type& conn) | object_statements (connection_type& conn) | |||
: object_statements_base (conn), | : object_statements_base (conn), | |||
container_statement_cache_ (conn), | ||||
select_image_binding_ (select_image_bind_, select_column_count), | select_image_binding_ (select_image_bind_, select_column_count), | |||
insert_image_binding_ (insert_image_bind_, insert_column_count), | insert_image_binding_ (insert_image_bind_, insert_column_count), | |||
update_image_binding_ (update_image_bind_, | update_image_binding_ (update_image_bind_, | |||
update_column_count + id_column_count + | update_column_count + id_column_count + | |||
managed_optimistic_column_count), | managed_optimistic_column_count), | |||
id_image_binding_ (update_image_bind_ + update_column_count, | id_image_binding_ (update_image_bind_ + update_column_count, | |||
id_column_count), | id_column_count), | |||
od_ (update_image_bind_ + update_column_count) | od_ (update_image_bind_ + update_column_count) | |||
{ | { | |||
image_.version = 0; | image_.version = 0; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 0 lines changed or added | |||
version.hxx | version.hxx | |||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
// Check that we have a compatible MySQL version (5.0.3 or later). | // Check that we have a compatible MySQL version (5.0.3 or later). | |||
// | // | |||
#if !defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID < 50003 | #if !defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID < 50003 | |||
# error incompatible MySQL version detected | # error incompatible MySQL version detected | |||
#endif | #endif | |||
// libodb-mysql version: odb interface version plus the bugfix | // libodb-mysql version: odb interface version plus the bugfix | |||
// version. | // version. | |||
// | // | |||
#define LIBODB_MYSQL_VERSION 2000000 | #define LIBODB_MYSQL_VERSION 2000100 | |||
#define LIBODB_MYSQL_VERSION_STR "2.0.0" | #define LIBODB_MYSQL_VERSION_STR "2.0.1" | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#endif // ODB_MYSQL_VERSION_HXX | #endif // ODB_MYSQL_VERSION_HXX | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||