diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-09 14:50:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-16 07:42:54 +0200 |
commit | d2c1f5f1a3063553483d09dec261efa44c6bc9bf (patch) | |
tree | 1503cbf2f20c5a2525d3fa0044addac4e8132a53 /odb/polymorphic-object-result.txx | |
parent | 821e1bdf35c6fc208c421fa630ad3f77e841b60e (diff) |
Implement two-phase session insertion
On the first step an uninitialized object is inserted into the cache
as before (this is necessary to handle recursive loading). The second
step is to notify the session that the object has been initialized.
On this second step the session can perform change tracking preparations,
such as make a copy of the object or reset the modification flag.
New test: common/session/custom (implements a custom session that uses
copies to track changes).
Diffstat (limited to 'odb/polymorphic-object-result.txx')
-rw-r--r-- | odb/polymorphic-object-result.txx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/odb/polymorphic-object-result.txx b/odb/polymorphic-object-result.txx index 5d6c479..69d365d 100644 --- a/odb/polymorphic-object-result.txx +++ b/odb/polymorphic-object-result.txx @@ -60,10 +60,12 @@ namespace odb typedef odb::object_traits<object_type> object_traits; - typename object_traits::reference_cache_traits::insert_guard ig ( + typename object_traits::reference_cache_traits::position_type p ( object_traits::reference_cache_traits::insert ( res_->db_, res_->load_id (), obj)); + typename object_traits::reference_cache_traits::insert_guard ig (p); res_->load (&obj, false); + object_traits::reference_cache_traits::initialize (p); ig.release (); } } |