aboutsummaryrefslogtreecommitdiff
path: root/tracer/transaction/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-08 12:36:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-08 15:47:26 +0200
commit35662787f479b93b3205310934574132609461cc (patch)
tree3a53faca30dde0ecfe7c66bfc667c915ee1bfe9b /tracer/transaction/driver.cxx
parent20c2f6cde170e1a8703858e17530fcf68e4efbe4 (diff)
Get rid of special tracer database
The include, types, and pragma tests have been moved to the common/ directory while the object test has been merged into common/lifecycle. The transaction test will be re-implemented as common/ test as soon as SQL statement tracing support is merged.
Diffstat (limited to 'tracer/transaction/driver.cxx')
-rw-r--r--tracer/transaction/driver.cxx92
1 files changed, 0 insertions, 92 deletions
diff --git a/tracer/transaction/driver.cxx b/tracer/transaction/driver.cxx
deleted file mode 100644
index e1c7849..0000000
--- a/tracer/transaction/driver.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-// file : tracer/transaction/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-// Test transaction operations.
-//
-
-#include <cassert>
-#include <iostream>
-
-#include <odb/exceptions.hxx>
-#include <odb/transaction.hxx>
-#include <odb/tracer/database.hxx>
-#include <odb/tracer/transaction.hxx>
-
-using namespace std;
-using namespace odb::core;
-namespace tracer = odb::tracer;
-
-int
-main ()
-{
- tracer::database db;
-
- assert (!transaction::has_current ());
-
- // Current and db accessors.
- //
- cout << "test 001" << endl;
- {
- transaction t (db.begin ());
- 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.
- //
- cout << "test 002" << endl;
- {
- transaction t (db.begin ());
- t.commit ();
- }
-
- // Rollback.
- //
- cout << "test 003" << endl;
- {
- transaction t (db.begin ());
- t.rollback ();
- }
-
- // Auto rollback.
- //
- cout << "test 004" << endl;
- {
- transaction t (db.begin ());
- }
-
- // Nested transaction.
- //
- cout << "test 005" << endl;
- {
- transaction t (db.begin ());
- try
- {
- transaction n (db.begin ());
- }
- catch (const already_in_transaction&)
- {
- cout << "already_in_transaction" << endl;
- }
- }
-
- // Concrete transaction type.
- //
- cout << "test 006" << endl;
- {
- assert (sizeof (tracer::transaction) == sizeof (transaction));
-
- tracer::transaction t (db.begin ());
- tracer::transaction& r (tracer::transaction::current ());
- assert (&t == &r);
- }
-}