diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-21 13:00:33 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-21 13:00:33 +0200 |
commit | a28444da4ca6adb016f719e032174ccb54e1692e (patch) | |
tree | 75fe8ceae2d20baa3d4b5375a832598efe8b2fce /odb/object-result.txx | |
parent | 0046a34d5ad5fc1e88b33279605f179646b0ea59 (diff) |
Rework const object handling
Now objects are always loaded as non-const and the object cache in
session treats all objects as non-const.
Diffstat (limited to 'odb/object-result.txx')
-rw-r--r-- | odb/object-result.txx | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/odb/object-result.txx b/odb/object-result.txx index bd4e95e..c19e482 100644 --- a/odb/object-result.txx +++ b/odb/object-result.txx @@ -23,16 +23,13 @@ namespace odb result_impl<T, class_object>:: current () { - typedef typename object_traits::pointer_type unrestricted_pointer_type; - typedef typename object_traits::pointer_traits unrestricted_pointer_traits; - if (pointer_traits::null_ptr (current_) && !end_) { if (!session::has_current ()) { - unrestricted_pointer_type up (object_traits::create ()); - object_type& obj (unrestricted_pointer_traits::get_ref (up)); - current (pointer_type (up)); + pointer_type p (object_traits::create ()); + object_type& obj (pointer_traits::get_ref (p)); + current (p); load (obj); } else @@ -48,15 +45,13 @@ namespace odb current (p); else { - unrestricted_pointer_type up (object_traits::create ()); + pointer_type p (object_traits::create ()); - typename - pointer_cache_traits<unrestricted_pointer_type>::insert_guard ig ( - pointer_cache_traits<unrestricted_pointer_type>::insert ( - database (), id, up)); + typename pointer_cache_traits<pointer_type>::insert_guard ig ( + pointer_cache_traits<pointer_type>::insert (database (), id, p)); - object_type& obj (unrestricted_pointer_traits::get_ref (up)); - current (pointer_type (up)); + object_type& obj (pointer_traits::get_ref (p)); + current (p); load (obj); ig.release (); } |