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 ++++++ tracer/transaction/test.std | 2 ++ 2 files changed, 8 insertions(+) (limited to 'tracer') 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. diff --git a/tracer/transaction/test.std b/tracer/transaction/test.std index 8083774..792010c 100644 --- a/tracer/transaction/test.std +++ b/tracer/transaction/test.std @@ -1,5 +1,7 @@ test 001 begin transaction +begin transaction +rollback transaction rollback transaction test 002 begin transaction -- cgit v1.1