From aad1221242bb26e109aafc52d7a09dc2b04897ad Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Apr 2012 11:29:05 +0200 Subject: Make session optional --- odb/oracle/polymorphic-object-result.txx | 1 - odb/oracle/simple-object-statements.hxx | 1 - odb/oracle/simple-object-statements.txx | 16 ++++++++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/odb/oracle/polymorphic-object-result.txx b/odb/oracle/polymorphic-object-result.txx index f371258..af9f8eb 100644 --- a/odb/oracle/polymorphic-object-result.txx +++ b/odb/oracle/polymorphic-object-result.txx @@ -5,7 +5,6 @@ #include #include -#include #include // result_not_cached #include diff --git a/odb/oracle/simple-object-statements.hxx b/odb/oracle/simple-object-statements.hxx index 2a007b2..101c96f 100644 --- a/odb/oracle/simple-object-statements.hxx +++ b/odb/oracle/simple-object-statements.hxx @@ -13,7 +13,6 @@ #include #include -#include #include diff --git a/odb/oracle/simple-object-statements.txx b/odb/oracle/simple-object-statements.txx index 83aff45..a5f30e4 100644 --- a/odb/oracle/simple-object-statements.txx +++ b/odb/oracle/simple-object-statements.txx @@ -4,7 +4,6 @@ #include // std::memset -#include #include #include @@ -126,15 +125,16 @@ namespace odb void object_statements:: clear_delayed_ () { - // Remove the objects from the session cache. + // Remove the objects from the session cache. This is not the most + // efficient way to do this (cache_traits::erase() will check for + // a session on every iteration), but the delay vector won't be + // empty only if something goes wrong (i.e., we are throwing an + // exception). // - if (session::has_current ()) + for (typename delayed_loads::iterator i (delayed_.begin ()), + e (delayed_.end ()); i != e; ++i) { - for (typename delayed_loads::iterator i (delayed_.begin ()), - e (delayed_.end ()); i != e; ++i) - { - pointer_cache_traits::erase (i->pos); - } + pointer_cache_traits::erase (i->pos); } delayed_.clear (); -- cgit v1.1