From 658a2f07b47ed80bd3ca35edd7380493c326daa3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 27 Oct 2011 15:16:49 +0200 Subject: Add support for persistent classes without object ids New pragma id (object). New test: common/no-id. --- odb/database.txx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'odb/database.txx') 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::insert (*this, id, obj); - return id; + reference_cache_traits::insert (*this, obj); + + return object_traits::id (obj); } template @@ -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::insert (*this, id, pobj); - return id; + pointer_cache_traits::insert (*this, pobj); + + return object_traits::id (obj); } template @@ -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); -- cgit v1.1