diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-26 11:29:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-26 11:29:05 +0200 |
commit | 8b778f4638a017155c81bb5c9fd47afb1e0c7f0b (patch) | |
tree | 1155035588f8cef74db2769cd75e4e96b0312998 | |
parent | 42503207920b9264e04c97cb6a5c53214fd2eff8 (diff) |
Make session optional
-rw-r--r-- | odb/mysql/polymorphic-object-result.txx | 1 | ||||
-rw-r--r-- | odb/mysql/simple-object-statements.hxx | 1 | ||||
-rw-r--r-- | odb/mysql/simple-object-statements.txx | 16 |
3 files changed, 8 insertions, 10 deletions
diff --git a/odb/mysql/polymorphic-object-result.txx b/odb/mysql/polymorphic-object-result.txx index 2e27677..221060b 100644 --- a/odb/mysql/polymorphic-object-result.txx +++ b/odb/mysql/polymorphic-object-result.txx @@ -5,7 +5,6 @@ #include <cassert> #include <odb/callback.hxx> -#include <odb/cache-traits.hxx> #include <odb/exceptions.hxx> // result_not_cached #include <odb/mysql/polymorphic-object-statements.hxx> diff --git a/odb/mysql/simple-object-statements.hxx b/odb/mysql/simple-object-statements.hxx index 9a3e80e..c2e9c74 100644 --- a/odb/mysql/simple-object-statements.hxx +++ b/odb/mysql/simple-object-statements.hxx @@ -13,7 +13,6 @@ #include <odb/forward.hxx> #include <odb/traits.hxx> -#include <odb/cache-traits.hxx> #include <odb/details/shared-ptr.hxx> diff --git a/odb/mysql/simple-object-statements.txx b/odb/mysql/simple-object-statements.txx index 81f3bce..743d083 100644 --- a/odb/mysql/simple-object-statements.txx +++ b/odb/mysql/simple-object-statements.txx @@ -4,7 +4,6 @@ #include <cstring> // std::memset -#include <odb/session.hxx> #include <odb/callback.hxx> #include <odb/exceptions.hxx> @@ -128,15 +127,16 @@ namespace odb void object_statements<T>:: 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 (); |