aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-26 11:29:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-26 11:29:05 +0200
commite2b40ba241540b1de28dc5e759ad2a6e536c4da3 (patch)
tree383853108b8a958657df7175626ea6576eb8dbf2
parent290d22210040a7b373e2dc9084240cdeffa1fa3a (diff)
Make session optional
-rw-r--r--odb/mssql/polymorphic-object-result.txx1
-rw-r--r--odb/mssql/simple-object-statements.hxx1
-rw-r--r--odb/mssql/simple-object-statements.txx16
3 files changed, 8 insertions, 10 deletions
diff --git a/odb/mssql/polymorphic-object-result.txx b/odb/mssql/polymorphic-object-result.txx
index be4a6ab..02e2cd1 100644
--- a/odb/mssql/polymorphic-object-result.txx
+++ b/odb/mssql/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/mssql/exceptions.hxx> // long_data_reload
diff --git a/odb/mssql/simple-object-statements.hxx b/odb/mssql/simple-object-statements.hxx
index 62d2c3c..d4809b4 100644
--- a/odb/mssql/simple-object-statements.hxx
+++ b/odb/mssql/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/mssql/simple-object-statements.txx b/odb/mssql/simple-object-statements.txx
index 5601fda..6620c40 100644
--- a/odb/mssql/simple-object-statements.txx
+++ b/odb/mssql/simple-object-statements.txx
@@ -4,7 +4,6 @@
#include <cstring> // std::memset
-#include <odb/session.hxx>
#include <odb/callback.hxx>
#include <odb/exceptions.hxx>
@@ -131,15 +130,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 ();