binding.hxx   binding.hxx 
skipping to change at line 14 skipping to change at line 14
#ifndef ODB_MYSQL_BINDING_HXX #ifndef ODB_MYSQL_BINDING_HXX
#define ODB_MYSQL_BINDING_HXX #define ODB_MYSQL_BINDING_HXX
#include <odb/pre.hxx> #include <odb/pre.hxx>
#include <cstddef> // std::size_t #include <cstddef> // std::size_t
#include <odb/forward.hxx> #include <odb/forward.hxx>
#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx> #include <odb/mysql/version.hxx>
#include <odb/mysql/mysql-types.hxx>
#include <odb/mysql/details/export.hxx> #include <odb/mysql/details/export.hxx>
namespace odb namespace odb
{ {
namespace mysql namespace mysql
{ {
class LIBODB_MYSQL_EXPORT binding class LIBODB_MYSQL_EXPORT binding
{ {
public: public:
binding (): bind (0), count (0), version (0) {}
binding (MYSQL_BIND* b, std::size_t n) binding (MYSQL_BIND* b, std::size_t n)
: bind (b), count (n), version (0) : bind (b), count (n), version (0)
{ {
} }
MYSQL_BIND* bind; MYSQL_BIND* bind;
std::size_t count; std::size_t count;
std::size_t version; std::size_t version;
private: private:
 End of changes. 3 change blocks. 
1 lines changed or deleted 3 lines changed or added


 connection.hxx   connection.hxx 
// file : odb/mysql/connection.hxx // file : odb/mysql/connection.hxx
// copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC // copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file // license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_MYSQL_CONNECTION_HXX #ifndef ODB_MYSQL_CONNECTION_HXX
#define ODB_MYSQL_CONNECTION_HXX #define ODB_MYSQL_CONNECTION_HXX
#include <odb/pre.hxx> #include <odb/pre.hxx>
#include <vector> #include <vector>
#include <memory> // std::auto_ptr
#include <odb/forward.hxx> #include <odb/forward.hxx>
#include <odb/connection.hxx> #include <odb/connection.hxx>
#include <odb/mysql/mysql.hxx> #include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx> #include <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx> #include <odb/mysql/forward.hxx>
#include <odb/mysql/tracer.hxx> #include <odb/mysql/tracer.hxx>
#include <odb/mysql/transaction-impl.hxx> #include <odb/mysql/transaction-impl.hxx>
#include <odb/mysql/auto-handle.hxx> #include <odb/mysql/auto-handle.hxx>
#include <odb/details/shared-ptr.hxx> #include <odb/details/shared-ptr.hxx>
#include <odb/details/unique-ptr.hxx>
#include <odb/mysql/details/export.hxx> #include <odb/mysql/details/export.hxx>
namespace odb namespace odb
{ {
namespace mysql namespace mysql
{ {
class statement_cache; class statement_cache;
class connection; class connection;
skipping to change at line 175 skipping to change at line 175
bool failed_; bool failed_;
MYSQL mysql_; MYSQL mysql_;
auto_handle<MYSQL> handle_; auto_handle<MYSQL> handle_;
statement* active_; statement* active_;
// Keep statement_cache_ after handle_ so that it is destroyed before // Keep statement_cache_ after handle_ so that it is destroyed before
// the connection is closed. // the connection is closed.
// //
std::auto_ptr<statement_cache_type> statement_cache_; details::unique_ptr<statement_cache_type> statement_cache_;
// List of "delayed" statement handles to be freed next time there // List of "delayed" statement handles to be freed next time there
// is no active statement. // is no active statement.
// //
typedef std::vector<MYSQL_STMT*> stmt_handles; typedef std::vector<MYSQL_STMT*> stmt_handles;
stmt_handles stmt_handles_; stmt_handles stmt_handles_;
}; };
} }
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added


 container-statements.hxx   container-statements.hxx 
skipping to change at line 153 skipping to change at line 153
{ {
data_id_binding_version_ = v; data_id_binding_version_ = v;
} }
binding& binding&
data_image_binding () data_image_binding ()
{ {
return data_image_binding_; return data_image_binding_;
} }
my_bool*
data_image_truncated ()
{
return data_image_truncated_;
}
binding& binding&
select_image_binding () select_image_binding ()
{ {
return select_image_binding_; return select_image_binding_;
} }
my_bool* my_bool*
select_image_truncated () select_image_truncated ()
{ {
return select_image_truncated_; return select_image_truncated_;
skipping to change at line 232 skipping to change at line 226
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_binding_version_; std::size_t cond_id_binding_version_;
binding cond_image_binding_; binding cond_image_binding_;
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_binding_version_; std::size_t data_id_binding_version_;
binding data_image_binding_; binding data_image_binding_;
my_bool* data_image_truncated_;
// Skips the id from data_image_binding. // Skips the id from data_image_binding.
// //
binding select_image_binding_; binding select_image_binding_;
my_bool* select_image_truncated_; my_bool* select_image_truncated_;
const char* insert_one_text_; const char* insert_one_text_;
const char* select_all_text_; const char* select_all_text_;
const char* delete_all_text_; const char* delete_all_text_;
skipping to change at line 267 skipping to change at line 260
container_statements_impl (connection_type&); container_statements_impl (connection_type&);
private: private:
container_statements_impl (const container_statements_impl&); container_statements_impl (const container_statements_impl&);
container_statements_impl& operator= (const container_statements_impl &); container_statements_impl& operator= (const container_statements_impl &);
private: private:
MYSQL_BIND cond_image_bind_[traits::cond_column_count]; MYSQL_BIND cond_image_bind_[traits::cond_column_count];
MYSQL_BIND data_image_bind_[traits::data_column_count]; MYSQL_BIND data_image_bind_[traits::data_column_count];
my_bool data_image_truncated_array_[traits::data_column_count]; my_bool select_image_truncated_array_[traits::data_column_count -
traits::id_column_count];
}; };
} }
} }
#include <odb/mysql/container-statements.txx> #include <odb/mysql/container-statements.txx>
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_MYSQL_CONTAINER_STATEMENTS_HXX #endif // ODB_MYSQL_CONTAINER_STATEMENTS_HXX
 End of changes. 3 change blocks. 
8 lines changed or deleted 2 lines changed or added


 container-statements.txx   container-statements.txx 
skipping to change at line 42 skipping to change at line 42
data_image_.version = 0; data_image_.version = 0;
data_image_version_ = 0; data_image_version_ = 0;
data_id_binding_version_ = 0; data_id_binding_version_ = 0;
} }
template <typename T> template <typename T>
container_statements_impl<T>:: container_statements_impl<T>::
container_statements_impl (connection_type& conn) container_statements_impl (connection_type& conn)
: base (conn) : base (conn)
{ {
this->data_image_truncated_ = data_image_truncated_array_; this->select_image_truncated_ = select_image_truncated_array_;
this->select_image_truncated_ = data_image_truncated_array_ +
traits::id_column_count;
this->cond_image_binding_.bind = cond_image_bind_; this->cond_image_binding_.bind = cond_image_bind_;
this->cond_image_binding_.count = traits::cond_column_count; this->cond_image_binding_.count = traits::cond_column_count;
this->data_image_binding_.bind = data_image_bind_; this->data_image_binding_.bind = data_image_bind_;
this->data_image_binding_.count = traits::data_column_count; this->data_image_binding_.count = traits::data_column_count;
this->select_image_binding_.bind = data_image_bind_ + this->select_image_binding_.bind = data_image_bind_ +
traits::id_column_count; traits::id_column_count;
this->select_image_binding_.count = traits::data_column_count - this->select_image_binding_.count = traits::data_column_count -
traits::id_column_count; traits::id_column_count;
std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_)); std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_));
std::memset (data_image_bind_, 0, sizeof (data_image_bind_)); std::memset (data_image_bind_, 0, sizeof (data_image_bind_));
std::memset (data_image_truncated_array_, std::memset (select_image_truncated_array_,
0, 0,
sizeof (data_image_truncated_array_)); sizeof (select_image_truncated_array_));
for (std::size_t i (0); i < traits::data_column_count; ++i) for (std::size_t i (0);
data_image_bind_[i].error = data_image_truncated_array_ + i; i < traits::data_column_count - traits::id_column_count;
++i)
data_image_bind_[i + traits::id_column_count].error =
select_image_truncated_array_ + i;
this->insert_one_text_ = traits::insert_one_statement; this->insert_one_text_ = traits::insert_one_statement;
this->select_all_text_ = traits::select_all_statement; this->select_all_text_ = traits::select_all_statement;
this->delete_all_text_ = traits::delete_all_statement; this->delete_all_text_ = traits::delete_all_statement;
} }
} }
} }
 End of changes. 4 change blocks. 
7 lines changed or deleted 8 lines changed or added


 database.hxx   database.hxx 
// file : odb/mysql/database.hxx // file : odb/mysql/database.hxx
// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file // license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_MYSQL_DATABASE_HXX #ifndef ODB_MYSQL_DATABASE_HXX
#define ODB_MYSQL_DATABASE_HXX #define ODB_MYSQL_DATABASE_HXX
#include <odb/pre.hxx> #include <odb/pre.hxx>
#include <string> #include <string>
#include <memory> // std::auto_ptr #include <memory> // std::auto_ptr, std::unique_ptr
#include <iosfwd> // std::ostream #include <iosfwd> // std::ostream
#include <odb/database.hxx> #include <odb/database.hxx>
#include <odb/details/unique-ptr.hxx>
#include <odb/details/transfer-ptr.hxx>
#include <odb/mysql/mysql.hxx> #include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx> #include <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx> #include <odb/mysql/forward.hxx>
#include <odb/mysql/tracer.hxx> #include <odb/mysql/tracer.hxx>
#include <odb/mysql/connection.hxx> #include <odb/mysql/connection.hxx>
#include <odb/mysql/connection-factory.hxx> #include <odb/mysql/connection-factory.hxx>
#include <odb/mysql/details/export.hxx> #include <odb/mysql/details/export.hxx>
skipping to change at line 45 skipping to change at line 47
// for all the arguments except passwd and socket. // for all the arguments except passwd and socket.
// //
database (const char* user, database (const char* user,
const char* passwd, const char* passwd,
const char* db, const char* db,
const char* host = 0, const char* host = 0,
unsigned int port = 0, unsigned int port = 0,
const char* socket = 0, const char* socket = 0,
const char* charset = 0, const char* charset = 0,
unsigned long client_flags = 0, unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
std::auto_ptr<connection_factory> (0)); details::transfer_ptr<connection_factory> ());
database (const std::string& user, database (const std::string& user,
const std::string& passwd, const std::string& passwd,
const std::string& db, const std::string& db,
const std::string& host = "", const std::string& host = "",
unsigned int port = 0, unsigned int port = 0,
const std::string* socket = 0, const std::string* socket = 0,
const std::string& charset = "", const std::string& charset = "",
unsigned long client_flags = 0, unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
std::auto_ptr<connection_factory> (0)); details::transfer_ptr<connection_factory> ());
database (const std::string& user, database (const std::string& user,
const std::string* passwd, const std::string* passwd,
const std::string& db, const std::string& db,
const std::string& host = "", const std::string& host = "",
unsigned int port = 0, unsigned int port = 0,
const std::string* socket = 0, const std::string* socket = 0,
const std::string& charset = "", const std::string& charset = "",
unsigned long client_flags = 0, unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
std::auto_ptr<connection_factory> (0)); details::transfer_ptr<connection_factory> ());
database (const std::string& user, database (const std::string& user,
const std::string& passwd, const std::string& passwd,
const std::string& db, const std::string& db,
const std::string& host, const std::string& host,
unsigned int port, unsigned int port,
const std::string& socket, const std::string& socket,
const std::string& charset = "", const std::string& charset = "",
unsigned long client_flags = 0, unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
std::auto_ptr<connection_factory> (0)); details::transfer_ptr<connection_factory> ());
database (const std::string& user, database (const std::string& user,
const std::string* passwd, const std::string* passwd,
const std::string& db, const std::string& db,
const std::string& host, const std::string& host,
unsigned int port, unsigned int port,
const std::string& socket, const std::string& socket,
const std::string& charset = "", const std::string& charset = "",
unsigned long client_flags = 0, unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
std::auto_ptr<connection_factory> (0)); details::transfer_ptr<connection_factory> ());
// Extract the database parameters from the command line. The // Extract the database parameters from the command line. The
// following options are recognized: // following options are recognized:
// //
// --user // --user
// --password // --password
// --database // --database
// --host // --host
// --port // --port
// --socket // --socket
skipping to change at line 113 skipping to change at line 115
// For more information, see the output of the print_usage() function // For more information, see the output of the print_usage() function
// below. If erase is true, the above options are removed from the // below. If erase is true, the above options are removed from the
// argv array and the argc count is updated accordingly. This // argv array and the argc count is updated accordingly. This
// constructor may throw the cli_exception exception. // constructor may throw the cli_exception exception.
// //
database (int& argc, database (int& argc,
char* argv[], char* argv[],
bool erase = false, bool erase = false,
const std::string& charset = "", const std::string& charset = "",
unsigned long client_flags = 0, unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
std::auto_ptr<connection_factory> (0)); details::transfer_ptr<connection_factory> ());
static void static void
print_usage (std::ostream&); print_usage (std::ostream&);
public: public:
const char* const char*
user () const user () const
{ {
return user_.c_str (); return user_.c_str ();
} }
skipping to change at line 214 skipping to change at line 216
std::string user_; std::string user_;
std::string passwd_str_; std::string passwd_str_;
const char* passwd_; const char* passwd_;
std::string db_; std::string db_;
std::string host_; std::string host_;
unsigned int port_; unsigned int port_;
std::string socket_str_; std::string socket_str_;
const char* socket_; const char* socket_;
std::string charset_; std::string charset_;
unsigned long client_flags_; unsigned long client_flags_;
std::auto_ptr<connection_factory> factory_; details::unique_ptr<connection_factory> factory_;
}; };
} }
} }
#include <odb/mysql/database.ixx> #include <odb/mysql/database.ixx>
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_MYSQL_DATABASE_HXX #endif // ODB_MYSQL_DATABASE_HXX
 End of changes. 9 change blocks. 
14 lines changed or deleted 16 lines changed or added


 forward.hxx   forward.hxx 
skipping to change at line 41 skipping to change at line 41
statement_update statement_update
}; };
class binding; 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 object_statements_no_id; class polymorphic_root_object_statements;
template <typename T>
class polymorphic_derived_object_statements;
template <typename T>
class no_id_object_statements;
template <typename T> template <typename T>
class view_statements; class view_statements;
template <typename T> template <typename T>
class container_statements; class container_statements;
} }
namespace details namespace details
{ {
 End of changes. 1 change blocks. 
1 lines changed or deleted 7 lines changed or added


 statement-cache.hxx   statement-cache.hxx 
skipping to change at line 14 skipping to change at line 14
#ifndef ODB_MYSQL_STATEMENT_CACHE_HXX #ifndef ODB_MYSQL_STATEMENT_CACHE_HXX
#define ODB_MYSQL_STATEMENT_CACHE_HXX #define ODB_MYSQL_STATEMENT_CACHE_HXX
#include <odb/pre.hxx> #include <odb/pre.hxx>
#include <map> #include <map>
#include <typeinfo> #include <typeinfo>
#include <odb/forward.hxx> #include <odb/forward.hxx>
#include <odb/traits.hxx>
#include <odb/mysql/version.hxx> #include <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx>
#include <odb/mysql/statements-base.hxx> #include <odb/mysql/statements-base.hxx>
#include <odb/mysql/object-statements.hxx>
#include <odb/mysql/view-statements.hxx>
#include <odb/details/shared-ptr.hxx> #include <odb/details/shared-ptr.hxx>
#include <odb/details/type-info.hxx> #include <odb/details/type-info.hxx>
#include <odb/mysql/details/export.hxx> #include <odb/mysql/details/export.hxx>
namespace odb namespace odb
{ {
namespace mysql namespace mysql
{ {
class connection;
class LIBODB_MYSQL_EXPORT statement_cache class LIBODB_MYSQL_EXPORT statement_cache
{ {
public: public:
statement_cache (connection& conn) statement_cache (connection& conn): conn_ (conn) {}
: conn_ (conn)
{
}
template <typename T> template <typename T>
typename object_statements_selector<T>::type& typename object_traits<T>::statements_type&
find_object () find_object ();
{
typedef typename object_statements_selector<T>::type object_stateme
nts;
map::iterator i (map_.find (&typeid (T)));
if (i != map_.end ())
return static_cast<object_statements&> (*i->second);
details::shared_ptr<object_statements> p (
new (details::shared) object_statements (conn_));
map_.insert (map::value_type (&typeid (T), p));
return *p;
}
template <typename T> template <typename T>
view_statements<T>& view_statements<T>&
find_view () find_view ();
{
map::iterator i (map_.find (&typeid (T)));
if (i != map_.end ())
return static_cast<view_statements<T>&> (*i->second);
details::shared_ptr<view_statements<T> > p (
new (details::shared) view_statements<T> (conn_));
map_.insert (map::value_type (&typeid (T), p));
return *p;
}
private: private:
typedef std::map<const std::type_info*, typedef std::map<const std::type_info*,
details::shared_ptr<statements_base>, details::shared_ptr<statements_base>,
details::type_info_comparator> map; details::type_info_comparator> map;
connection& conn_; connection& conn_;
map map_; map map_;
}; };
} }
} }
#include <odb/mysql/statement-cache.txx>
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_MYSQL_STATEMENT_CACHE_HXX #endif // ODB_MYSQL_STATEMENT_CACHE_HXX
 End of changes. 8 change blocks. 
38 lines changed or deleted 8 lines changed or added


 statement.hxx   statement.hxx 
skipping to change at line 149 skipping to change at line 149
virtual void virtual void
cancel (); cancel ();
private: private:
select_statement (const select_statement&); select_statement (const select_statement&);
select_statement& operator= (const select_statement&); select_statement& operator= (const select_statement&);
private: private:
bool end_; bool end_;
bool cached_; bool cached_;
bool freed_;
std::size_t rows_; std::size_t rows_;
std::size_t size_; std::size_t size_;
binding* param_; binding* param_;
std::size_t param_version_; std::size_t param_version_;
binding& result_; binding& result_;
std::size_t result_version_; std::size_t result_version_;
}; };
struct LIBODB_MYSQL_EXPORT auto_result
{
explicit auto_result (select_statement& s): s_ (s) {}
~auto_result () {s_.free_result ();}
private:
auto_result (const auto_result&);
auto_result& operator= (const auto_result&);
private:
select_statement& s_;
};
class LIBODB_MYSQL_EXPORT insert_statement: public statement class LIBODB_MYSQL_EXPORT insert_statement: public statement
{ {
public: public:
virtual virtual
~insert_statement (); ~insert_statement ();
insert_statement (connection& conn, insert_statement (connection& conn,
const std::string& text, const std::string& text,
binding& param); binding& param);
 End of changes. 2 change blocks. 
0 lines changed or deleted 14 lines changed or added


 version.hxx   version.hxx 
skipping to change at line 39 skipping to change at line 39
// 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 != 10800 #if ODB_VERSION != 20000
# error incompatible odb interface version detected # error incompatible odb interface version detected
#endif #endif
// 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 1080000 #define LIBODB_MYSQL_VERSION 2000000
#define LIBODB_MYSQL_VERSION_STR "1.8.0" #define LIBODB_MYSQL_VERSION_STR "2.0.0"
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_MYSQL_VERSION_HXX #endif // ODB_MYSQL_VERSION_HXX
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 view-result.hxx   view-result.hxx 
skipping to change at line 12 skipping to change at line 12
// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file // license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_MYSQL_VIEW_RESULT_HXX #ifndef ODB_MYSQL_VIEW_RESULT_HXX
#define ODB_MYSQL_VIEW_RESULT_HXX #define ODB_MYSQL_VIEW_RESULT_HXX
#include <odb/pre.hxx> #include <odb/pre.hxx>
#include <cstddef> // std::size_t #include <cstddef> // std::size_t
#include <odb/view-result.hxx>
#include <odb/details/shared-ptr.hxx> #include <odb/details/shared-ptr.hxx>
#include <odb/mysql/version.hxx> #include <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx> // query, view_statements #include <odb/mysql/forward.hxx> // query, view_statements
#include <odb/mysql/result.hxx>
#include <odb/mysql/statement.hxx> #include <odb/mysql/statement.hxx>
namespace odb namespace odb
{ {
namespace mysql namespace mysql
{ {
template <typename T> template <typename T>
class view_result_impl: public odb::view_result_impl<T> class view_result_impl: public odb::view_result_impl<T>
{ {
public: public:
typedef odb::view_result_impl<T> base_type; typedef odb::view_result_impl<T> base_type;
typedef typename base_type::view_type view_type; typedef typename base_type::view_type view_type;
typedef typename base_type::view_traits view_traits; typedef typename base_type::view_traits view_traits;
typedef typename base_type::pointer_type pointer_type; typedef typename base_type::pointer_type pointer_type;
typedef typename base_type::pointer_traits pointer_traits; typedef typename base_type::pointer_traits pointer_traits;
typedef view_statements<view_type> statements_type;
virtual virtual
~view_result_impl (); ~view_result_impl ();
view_result_impl (const query&, view_result_impl (const query&,
details::shared_ptr<select_statement>, details::shared_ptr<select_statement>,
view_statements<view_type>&); statements_type&);
virtual void virtual void
load (view_type&); load (view_type&);
virtual void virtual void
next (); next ();
virtual void virtual void
cache (); cache ();
skipping to change at line 62 skipping to change at line 65
size (); size ();
using base_type::current; using base_type::current;
private: private:
void void
fetch (); fetch ();
private: private:
details::shared_ptr<select_statement> statement_; details::shared_ptr<select_statement> statement_;
view_statements<view_type>& statements_; statements_type& statements_;
std::size_t count_; std::size_t count_;
}; };
} }
} }
#include <odb/mysql/view-result.txx> #include <odb/mysql/view-result.txx>
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_MYSQL_VIEW_RESULT_HXX #endif // ODB_MYSQL_VIEW_RESULT_HXX
 End of changes. 5 change blocks. 
3 lines changed or deleted 6 lines changed or added


 view-result.txx   view-result.txx 
skipping to change at line 18 skipping to change at line 18
#include <odb/mysql/view-statements.hxx> #include <odb/mysql/view-statements.hxx>
namespace odb namespace odb
{ {
namespace mysql namespace mysql
{ {
template <typename T> template <typename T>
view_result_impl<T>:: view_result_impl<T>::
~view_result_impl () ~view_result_impl ()
{ {
if (!this->end_)
statement_->free_result ();
} }
template <typename T> template <typename T>
view_result_impl<T>:: view_result_impl<T>::
view_result_impl (const query&, view_result_impl (const query&,
details::shared_ptr<select_statement> statement, details::shared_ptr<select_statement> statement,
view_statements<view_type>& statements) statements_type& statements)
: base_type (statements.connection ().database ()), : base_type (statements.connection ().database ()),
statement_ (statement), statement_ (statement),
statements_ (statements), statements_ (statements),
count_ (0) count_ (0)
{ {
} }
template <typename T> template <typename T>
void view_result_impl<T>:: void view_result_impl<T>::
load (view_type& view) load (view_type& view)
{ {
if (count_ > statement_->fetched ()) if (count_ > statement_->fetched ())
fetch (); fetch ();
odb::database& db (this->database ()); odb::database& db (this->database ());
view_traits::callback (db, view, callback_event::pre_load); view_traits::callback (db, view, callback_event::pre_load);
view_traits::init (view, statements_.image (), db); view_traits::init (view, statements_.image (), &db);
view_traits::callback (db, view, callback_event::post_load); view_traits::callback (db, view, callback_event::post_load);
} }
template <typename T> template <typename T>
void view_result_impl<T>:: void view_result_impl<T>::
next () next ()
{ {
this->current (pointer_type ()); this->current (pointer_type ());
// If we are cached, simply increment the position and // If we are cached, simply increment the position and
// postpone the actual row fetching until later. This way // postpone the actual row fetching until later. This way
// if the same view is loaded in between iteration, the // if the same view is loaded in between iteration, the
// image won't be messed up. // image won't be messed up.
// //
count_++; count_++;
if (statement_->cached ()) if (statement_->cached ())
this->end_ = count_ > statement_->result_size (); this->end_ = count_ > statement_->result_size ();
else else
fetch (); fetch ();
if (this->end_)
statement_->free_result ();
} }
template <typename T> template <typename T>
void view_result_impl<T>:: void view_result_impl<T>::
fetch () fetch ()
{ {
// If the result is cached, the image can grow between calls // If the result is cached, the image can grow between calls
// to fetch() as a result of other statements execution. // to fetch() as a result of other statements execution.
// //
if (statement_->cached ()) if (statement_->cached ())
skipping to change at line 135 skipping to change at line 140
template <typename T> template <typename T>
void view_result_impl<T>:: void view_result_impl<T>::
cache () cache ()
{ {
if (!statement_->cached ()) if (!statement_->cached ())
{ {
statement_->cache (); statement_->cache ();
if (count_ >= statement_->result_size ()) if (count_ >= statement_->result_size ())
{
statement_->free_result ();
this->end_ = true; this->end_ = true;
}
} }
} }
template <typename T> template <typename T>
std::size_t view_result_impl<T>:: std::size_t view_result_impl<T>::
size () size ()
{ {
if (!statement_->cached ()) if (!statement_->cached ())
throw result_not_cached (); throw result_not_cached ();
 End of changes. 6 change blocks. 
2 lines changed or deleted 10 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/