aboutsummaryrefslogtreecommitdiff
path: root/tracer/transaction
diff options
context:
space:
mode:
Diffstat (limited to 'tracer/transaction')
-rw-r--r--tracer/transaction/driver.cxx92
-rw-r--r--tracer/transaction/makefile87
-rw-r--r--tracer/transaction/test.std21
3 files changed, 0 insertions, 200 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);
- }
-}
diff --git a/tracer/transaction/makefile b/tracer/transaction/makefile
deleted file mode 100644
index 5cc6ef5..0000000
--- a/tracer/transaction/makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-# file : tracer/transaction/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : GNU GPL v2; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Import.
-#
-$(call import,\
- $(scf_root)/import/libodb/stub.make,\
- l: odb.l,cpp-options: odb.l.cpp-options)
-
-$(call import,\
- $(scf_root)/import/libodb-tracer/stub.make,\
- l: odb_tracer.l,cpp-options: odb_tracer.l.cpp-options)
-
-# Build.
-#
-$(driver): $(cxx_obj) $(odb_tracer.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
-$(cxx_obj) $(cxx_od): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
-
-$(call include-dep,$(cxx_od))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Dist
-#
-$(dist): sources := $(cxx_tun)
-$(dist): data_dist := test.std
-$(dist): export name := $(subst /,-,$(subst $(src_root)/tracer/,,$(src_base)))
-$(dist): export extra_dist := $(data_dist) $(name)-vc9.vcproj \
-$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters
-$(dist):
- $(call dist-data,$(sources) $(data_dist))
- $(call meta-automake,../template/Makefile.am)
- $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj)
- $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj)
-
-# Test.
-#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< >$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od))
- $(call message,,rm -f $(out_base)/test.out)
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/dist.make)
-$(call include,$(bld_root)/meta/vc9proj.make)
-$(call include,$(bld_root)/meta/vc10proj.make)
-$(call include,$(bld_root)/meta/automake.make)
-
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/o-e.make)
diff --git a/tracer/transaction/test.std b/tracer/transaction/test.std
deleted file mode 100644
index 792010c..0000000
--- a/tracer/transaction/test.std
+++ /dev/null
@@ -1,21 +0,0 @@
-test 001
-begin transaction
-begin transaction
-rollback transaction
-rollback transaction
-test 002
-begin transaction
-commit transaction
-test 003
-begin transaction
-rollback transaction
-test 004
-begin transaction
-rollback transaction
-test 005
-begin transaction
-already_in_transaction
-rollback transaction
-test 006
-begin transaction
-rollback transaction