aboutsummaryrefslogtreecommitdiff
path: root/odb/database.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/database.txx
parentac2c76e2412ff332022215b71bb106c8ea6dd3d0 (diff)
Add support for persistent classes without object ids
New pragma id (object). New test: common/no-id.
Diffstat (limited to 'odb/database.txx')
-rw-r--r--odb/database.txx20
1 files changed, 10 insertions, 10 deletions
diff --git a/odb/database.txx b/odb/database.txx
index c70697d..42643aa 100644
--- a/odb/database.txx
+++ b/odb/database.txx
@@ -28,9 +28,9 @@ namespace odb
object_traits::persist (*this, obj);
object_traits::callback (*this, obj, callback_event::post_persist);
- const typename object_traits::id_type& id (object_traits::id (obj));
- reference_cache_traits<T>::insert (*this, id, obj);
- return id;
+ reference_cache_traits<T>::insert (*this, obj);
+
+ return object_traits::id (obj);
}
template <typename T>
@@ -54,9 +54,9 @@ namespace odb
object_traits::persist (*this, obj);
object_traits::callback (*this, obj, callback_event::post_persist);
- const typename object_traits::id_type& id (object_traits::id (obj));
- pointer_cache_traits<pointer_type>::insert (*this, id, pobj);
- return id;
+ pointer_cache_traits<pointer_type>::insert (*this, pobj);
+
+ return object_traits::id (obj);
}
template <typename T>
@@ -139,8 +139,8 @@ namespace odb
object_traits::callback (*this, obj,callback_event::pre_update);
- // Compiler error pointing here? Perhaps the object is readonly and
- // therefore does not provide the update() function?
+ // Compiler error pointing here? Perhaps the object is readonly or
+ // doesn't have an object id? Such objects cannot be updated.
//
object_traits::update (*this, obj);
@@ -166,8 +166,8 @@ namespace odb
object_traits::callback (*this, obj, callback_event::pre_update);
- // Compiler error pointing here? Perhaps the object is readonly and
- // therefore does not provide the update() function?
+ // Compiler error pointing here? Perhaps the object is readonly or
+ // doesn't have an object id? Such objects cannot be updated.
//
object_traits::update (*this, obj);