diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-24 13:42:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-24 13:42:05 +0200 |
commit | 1fca8273447e0048941bbfe8ca23466f103c42f3 (patch) | |
tree | 6d3f963ef4589ddedc1a37ad0205f08c6de5f57f /tracer | |
parent | 4fe60ba39a3aeb9d386132506d3baac736c32881 (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.
Diffstat (limited to 'tracer')
-rw-r--r-- | tracer/transaction/driver.cxx | 6 | ||||
-rw-r--r-- | tracer/transaction/test.std | 2 |
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 |