aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/session.cxx11
-rw-r--r--odb/session.hxx8
2 files changed, 11 insertions, 8 deletions
diff --git a/odb/session.cxx b/odb/session.cxx
index 71c8817..3ca6af4 100644
--- a/odb/session.cxx
+++ b/odb/session.cxx
@@ -14,12 +14,15 @@ namespace odb
static ODB_TLS_POINTER (session) current_session;
session::
- session ()
+ session (bool make_current)
{
- if (has_current ())
- throw already_in_session ();
+ if (make_current)
+ {
+ if (has_current ())
+ throw already_in_session ();
- current (*this);
+ current (*this);
+ }
}
session::
diff --git a/odb/session.hxx b/odb/session.hxx
index 1541fde..cfeebce 100644
--- a/odb/session.hxx
+++ b/odb/session.hxx
@@ -25,11 +25,11 @@ namespace odb
public:
typedef odb::database database_type;
- // Set the current thread's session to this session. If another
- // session is already in effect, throw the already_in_session
- // exception.
+ // If the make_current argument is true, then set the current thread's
+ // session to this session. If another session is already in effect,
+ // throw the already_in_session exception.
//
- session ();
+ session (bool make_current = true);
// Reset the current thread's session if it is this session.
//