object-statements.hxx | object-statements.hxx | |||
---|---|---|---|---|
skipping to change at line 380 | skipping to change at line 380 | |||
{ | { | |||
} | } | |||
id_type id; | id_type id; | |||
object_type* obj; | object_type* obj; | |||
position_type pos; | position_type pos; | |||
}; | }; | |||
typedef std::vector<delayed_load> delayed_loads; | typedef std::vector<delayed_load> delayed_loads; | |||
delayed_loads delayed_; | delayed_loads delayed_; | |||
// Delayed vectors swap guard. See the load_delayed_() function for | ||||
// details. | ||||
// | ||||
struct swap_guard | ||||
{ | ||||
swap_guard (object_statements& os, delayed_loads& dl) | ||||
: os_ (os), dl_ (dl) | ||||
{ | ||||
dl_.swap (os_.delayed_); | ||||
} | ||||
~swap_guard () | ||||
{ | ||||
os_.clear_delayed (); | ||||
dl_.swap (os_.delayed_); | ||||
} | ||||
private: | ||||
object_statements& os_; | ||||
delayed_loads& dl_; | ||||
}; | ||||
}; | }; | |||
} | } | |||
} | } | |||
#include <odb/sqlite/object-statements.ixx> | #include <odb/sqlite/object-statements.ixx> | |||
#include <odb/sqlite/object-statements.txx> | #include <odb/sqlite/object-statements.txx> | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#endif // ODB_SQLITE_OBJECT_STATEMENTS_HXX | #endif // ODB_SQLITE_OBJECT_STATEMENTS_HXX | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 22 lines changed or added | |||
object-statements.txx | object-statements.txx | |||
---|---|---|---|---|
// file : odb/sqlite/object-statements.txx | // file : odb/sqlite/object-statements.txx | |||
// author : Boris Kolpackov <boris@codesynthesis.com> | // author : Boris Kolpackov <boris@codesynthesis.com> | |||
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <cstring> // std::memset | #include <cstring> // std::memset | |||
#include <odb/session.hxx> | #include <odb/session.hxx> | |||
#include <odb/callback.hxx> | ||||
#include <odb/exceptions.hxx> | #include <odb/exceptions.hxx> | |||
#include <odb/sqlite/connection.hxx> | #include <odb/sqlite/connection.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace sqlite | namespace sqlite | |||
{ | { | |||
template <typename T> | template <typename T> | |||
object_statements<T>:: | object_statements<T>:: | |||
skipping to change at line 46 | skipping to change at line 47 | |||
std::memset (out_image_truncated_, 0, sizeof (out_image_truncated_)); | std::memset (out_image_truncated_, 0, sizeof (out_image_truncated_)); | |||
for (std::size_t i (0); i < object_traits::out_column_count; ++i) | for (std::size_t i (0); i < object_traits::out_column_count; ++i) | |||
out_image_bind_[i].truncated = out_image_truncated_ + i; | out_image_bind_[i].truncated = out_image_truncated_ + i; | |||
} | } | |||
template <typename T> | template <typename T> | |||
void object_statements<T>:: | void object_statements<T>:: | |||
load_delayed_ () | load_delayed_ () | |||
{ | { | |||
// We should be careful here: the delayed vector can change | ||||
// from under us as a result of a recursive load. | ||||
// | ||||
database& db (connection ().database ()); | database& db (connection ().database ()); | |||
while (!delayed_.empty ()) | delayed_loads dls; | |||
swap_guard sg (*this, dls); | ||||
while (!dls.empty ()) | ||||
{ | { | |||
delayed_load l (delayed_.back ()); | delayed_load l (dls.back ()); | |||
typename object_cache_traits::insert_guard g (l.pos); | typename object_cache_traits::insert_guard g (l.pos); | |||
delayed_.pop_back (); | dls.pop_back (); | |||
if (!object_traits::find_ (*this, l.id)) | if (!object_traits::find_ (*this, l.id)) | |||
throw object_not_persistent (); | throw object_not_persistent (); | |||
object_traits::callback (db, *l.obj, callback_event::pre_load); | ||||
// Our calls to init/load below can result in additional delayed | ||||
// loads being added to the delayed_ vector. We need to process | ||||
// those before we call the post callback. | ||||
// | ||||
object_traits::init (*l.obj, image (), db); | object_traits::init (*l.obj, image (), db); | |||
object_traits::load_ (*this, *l.obj); // Load containers, etc. | object_traits::load_ (*this, *l.obj); // Load containers, etc. | |||
if (!delayed_.empty ()) | ||||
load_delayed_ (); | ||||
object_traits::callback (db, *l.obj, callback_event::post_load); | ||||
g.release (); | g.release (); | |||
} | } | |||
} | } | |||
template <typename T> | template <typename T> | |||
void object_statements<T>:: | void object_statements<T>:: | |||
clear_delayed_ () | clear_delayed_ () | |||
{ | { | |||
// Remove the objects from the session cache. | // Remove the objects from the session cache. | |||
// | // | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 19 lines changed or added | |||
result.txx | result.txx | |||
---|---|---|---|---|
// file : odb/sqlite/result.txx | // file : odb/sqlite/result.txx | |||
// author : Boris Kolpackov <boris@codesynthesis.com> | // author : Boris Kolpackov <boris@codesynthesis.com> | |||
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/callback.hxx> | ||||
#include <odb/exceptions.hxx> | #include <odb/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace sqlite | namespace sqlite | |||
{ | { | |||
template <typename T> | template <typename T> | |||
result_impl<T>:: | result_impl<T>:: | |||
~result_impl () | ~result_impl () | |||
{ | { | |||
skipping to change at line 40 | skipping to change at line 41 | |||
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_); | |||
odb::database& db (this->database ()); | ||||
object_traits::callback (db, obj, callback_event::pre_load); | ||||
typename object_traits::image_type& i (statements_.image ()); | typename object_traits::image_type& i (statements_.image ()); | |||
object_traits::init (obj, i, this->database ()); | object_traits::init (obj, i, db); | |||
// Initialize the id image and binding and load the rest of the objec t | // Initialize the id image and binding and load the rest of the objec t | |||
// (containers, etc). | // (containers, etc). | |||
// | // | |||
typename object_traits::id_image_type& idi (statements_.id_image ()); | typename object_traits::id_image_type& idi (statements_.id_image ()); | |||
object_traits::init (idi, object_traits::id (i)); | object_traits::init (idi, object_traits::id (i)); | |||
binding& idb (statements_.id_image_binding ()); | binding& idb (statements_.id_image_binding ()); | |||
if (idi.version != statements_.id_image_version () || idb.version == 0) | if (idi.version != statements_.id_image_version () || idb.version == 0) | |||
{ | { | |||
object_traits::bind (idb.bind, idi); | object_traits::bind (idb.bind, idi); | |||
statements_.id_image_version (idi.version); | statements_.id_image_version (idi.version); | |||
idb.version++; | idb.version++; | |||
} | } | |||
object_traits::load_ (statements_, obj); | object_traits::load_ (statements_, obj); | |||
statements_.load_delayed (); | statements_.load_delayed (); | |||
object_traits::callback (db, obj, callback_event::post_load); | ||||
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 () | |||
{ | { | |||
load_image (); | load_image (); | |||
return object_traits::id (statements_.image ()); | return object_traits::id (statements_.image ()); | |||
} | } | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 7 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 != 10400 | #if ODB_VERSION != 10500 | |||
# 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 1040000 | #define LIBODB_SQLITE_VERSION 1050000 | |||
#define LIBODB_SQLITE_VERSION_STR "1.4.0" | #define LIBODB_SQLITE_VERSION_STR "1.5.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 | |||