aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-24 13:42:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-24 13:42:05 +0200
commit1fca8273447e0048941bbfe8ca23466f103c42f3 (patch)
tree6d3f963ef4589ddedc1a37ad0205f08c6de5f57f
parent4fe60ba39a3aeb9d386132506d3baac736c32881 (diff)
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.
-rw-r--r--tracer/transaction/driver.cxx6
-rw-r--r--tracer/transaction/test.std2
2 files changed, 8 insertions, 0 deletions
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