aboutsummaryrefslogtreecommitdiff
path: root/odb/object-result.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-27 15:16:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-27 15:16:49 +0200
commit658a2f07b47ed80bd3ca35edd7380493c326daa3 (patch)
tree9df443d8820a2a53f6b8839adc36cde0c723f5cd /odb/object-result.txx
parentac2c76e2412ff332022215b71bb106c8ea6dd3d0 (diff)
Add support for persistent classes without object ids
New pragma id (object). New test: common/no-id.
Diffstat (limited to 'odb/object-result.txx')
-rw-r--r--odb/object-result.txx41
1 files changed, 34 insertions, 7 deletions
diff --git a/odb/object-result.txx b/odb/object-result.txx
index c19e482..843ec59 100644
--- a/odb/object-result.txx
+++ b/odb/object-result.txx
@@ -9,18 +9,18 @@
namespace odb
{
//
- // result_impl
+ // object_result_impl
//
template <typename T>
- result_impl<T, class_object>::
- ~result_impl ()
+ object_result_impl<T>::
+ ~object_result_impl ()
{
}
template <typename T>
- typename result_impl<T, class_object>::pointer_type&
- result_impl<T, class_object>::
+ typename object_result_impl<T>::pointer_type&
+ object_result_impl<T>::
current ()
{
if (pointer_traits::null_ptr (current_) && !end_)
@@ -62,11 +62,38 @@ namespace odb
}
//
- // result_iterator
+ // object_result_impl_no_id
//
+ template <typename T>
+ object_result_impl_no_id<T>::
+ ~object_result_impl_no_id ()
+ {
+ }
template <typename T>
- void result_iterator<T, class_object>::
+ typename object_result_impl_no_id<T>::pointer_type&
+ object_result_impl_no_id<T>::
+ current ()
+ {
+ if (pointer_traits::null_ptr (current_) && !end_)
+ {
+ // Objects without ids are not stored in session cache.
+ //
+ pointer_type p (object_traits::create ());
+ object_type& obj (pointer_traits::get_ref (p));
+ current (p);
+ load (obj);
+ }
+
+ return current_;
+ }
+
+ //
+ // object_result_iterator
+ //
+
+ template <typename T, typename ID>
+ void object_result_iterator<T, ID>::
load (object_type& obj)
{
if (res_->end ())