From 1fca8273447e0048941bbfe8ca23466f103c42f3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 24 Aug 2011 13:42:05 +0200 Subject: Add support for transaction multiplexing Also delay getting a connection until after we do all the sanity checks (e.g., that there is no active transaction). Otherwise we are running risk of getting blocked rather than throwing an exception. --- tracer/transaction/driver.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tracer/transaction/driver.cxx') diff --git a/tracer/transaction/driver.cxx b/tracer/transaction/driver.cxx index f6945d4..e1c7849 100644 --- a/tracer/transaction/driver.cxx +++ b/tracer/transaction/driver.cxx @@ -33,6 +33,12 @@ main () assert (&t.database () == &db); assert (transaction::has_current ()); assert (&transaction::current () == &t); + transaction::reset_current (); + assert (!transaction::has_current ()); + transaction t2 (db.begin (), false); + assert (!transaction::has_current ()); + transaction::current (t2); + assert (&transaction::current () == &t2); } // Commit. -- cgit v1.1