diff options
-rw-r--r-- | INSTALL | 43 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | build.bat | 8 | ||||
-rw-r--r-- | build/import/libodb-tracer/LICENSE | 12 | ||||
-rw-r--r-- | build/import/libodb-tracer/configuration-rules.make | 15 | ||||
-rwxr-xr-x | build/import/libodb-tracer/configure | 55 | ||||
-rw-r--r-- | build/import/libodb-tracer/stub.make | 30 | ||||
-rw-r--r-- | common/include/driver.cxx (renamed from tracer/include/driver.cxx) | 5 | ||||
-rw-r--r-- | common/include/makefile (renamed from tracer/include/makefile) | 29 | ||||
-rw-r--r-- | common/include/obj1.hxx (renamed from tracer/include/obj1.hxx) | 2 | ||||
-rw-r--r-- | common/include/obj2.hxx (renamed from tracer/include/obj2.hxx) | 2 | ||||
-rw-r--r-- | common/include/obj3.hxx (renamed from tracer/include/obj3.hxx) | 2 | ||||
-rw-r--r-- | common/include/objs1.hxx (renamed from tracer/include/objs1.hxx) | 2 | ||||
-rw-r--r-- | common/include/objs2.hxx (renamed from tracer/include/objs2.hxx) | 2 | ||||
-rw-r--r-- | common/include/objs3.hxx (renamed from tracer/include/objs3.hxx) | 2 | ||||
-rw-r--r-- | common/include/objs4.hxx (renamed from tracer/include/objs4.hxx) | 8 | ||||
-rw-r--r-- | common/include/test.std (renamed from tracer/include/test.std) | 0 | ||||
-rw-r--r-- | common/include/test1.hxx (renamed from tracer/include/test1.hxx) | 4 | ||||
-rw-r--r-- | common/include/test2.hxx (renamed from tracer/include/test2.hxx) | 2 | ||||
-rw-r--r-- | common/include/test3.hxx (renamed from tracer/include/test3.hxx) | 2 | ||||
-rw-r--r-- | common/include/test4.hxx (renamed from tracer/include/test4.hxx) | 2 | ||||
-rw-r--r-- | common/lifecycle/driver.cxx | 124 | ||||
-rw-r--r-- | common/makefile | 3 | ||||
-rw-r--r-- | common/pragma/driver.cxx (renamed from tracer/pragma/driver.cxx) | 5 | ||||
-rw-r--r-- | common/pragma/makefile (renamed from tracer/types/makefile) | 44 | ||||
-rw-r--r-- | common/pragma/test.hxx (renamed from tracer/pragma/test.hxx) | 6 | ||||
-rw-r--r-- | common/pragma/test.std (renamed from tracer/pragma/test.std) | 0 | ||||
-rw-r--r-- | common/types/driver.cxx (renamed from tracer/types/driver.cxx) | 4 | ||||
-rw-r--r-- | common/types/makefile (renamed from tracer/object/makefile) | 43 | ||||
-rw-r--r-- | common/types/test.hxx (renamed from tracer/types/test.hxx) | 26 | ||||
-rw-r--r-- | common/types/test.std (renamed from tracer/types/test.std) | 0 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | m4/libodb-tracer.m4 | 84 | ||||
-rw-r--r-- | makefile | 10 | ||||
-rw-r--r-- | test.bat | 2 | ||||
-rw-r--r-- | tracer/Makefile.am | 7 | ||||
-rw-r--r-- | tracer/makefile | 41 | ||||
-rw-r--r-- | tracer/object/driver.cxx | 234 | ||||
-rw-r--r-- | tracer/object/test.hxx | 27 | ||||
-rw-r--r-- | tracer/object/test.std | 108 | ||||
-rw-r--r-- | tracer/pragma/makefile | 104 | ||||
-rw-r--r-- | tracer/template/Makefile.am | 31 | ||||
-rw-r--r-- | tracer/template/driver.cxx | 35 | ||||
-rw-r--r-- | tracer/template/makefile | 104 | ||||
-rw-r--r-- | tracer/template/template-vc10.vcxproj | 180 | ||||
-rw-r--r-- | tracer/template/template-vc10.vcxproj.filters | 25 | ||||
-rw-r--r-- | tracer/template/template-vc9.vcproj | 361 | ||||
-rw-r--r-- | tracer/template/test.hxx | 27 | ||||
-rw-r--r-- | tracer/template/test.std | 3 | ||||
-rw-r--r-- | tracer/test.bat | 70 | ||||
-rw-r--r-- | tracer/tracer-vc10.sln | 15 | ||||
-rw-r--r-- | tracer/tracer-vc9.sln | 15 | ||||
-rw-r--r-- | tracer/transaction/driver.cxx | 92 | ||||
-rw-r--r-- | tracer/transaction/makefile | 87 | ||||
-rw-r--r-- | tracer/transaction/test.std | 21 |
55 files changed, 252 insertions, 1918 deletions
@@ -12,7 +12,6 @@ Prerequisites Required: - odb http://www.codesynthesis.com/products/odb/ - libodb http://www.codesynthesis.com/products/odb/ - - libodb-tracer http://www.codesynthesis.com/products/odb/ - libodb-<database> http://www.codesynthesis.com/products/odb/ Optional: @@ -55,19 +54,19 @@ option to specify the build directory, for example: ./configure --with-odb=/tmp/odb -The configure script also expects the libodb, libodb-tracer, and -libodb-<database> headers and libraries to be installed in a directory -where the C++ compiler and linker will search for them by default (normally -/usr and /usr/local). If these libraries are installed in other directories, -you can use the CPPFLAGS and LDFLAGS configure variables to specify their -locations, for example: +The configure script also expects the libodb and libodb-<database> headers +and libraries to be installed in a directory where the C++ compiler and +linker will search for them by default (normally /usr and /usr/local). +If these libraries are installed in other directories, you can use the +CPPFLAGS and LDFLAGS configure variables to specify their locations, for +example: ./configure CPPFLAGS=-I/opt/libodb/include LDFLAGS=-L/opt/libodb/lib If these libraries are not installed and you would like to use their -build directories instead, you can use the --with-libodb, ---with-libodb-tracer, and --with-libodb-<database> configure options -to specify their locations, for example: +build directories instead, you can use the --with-libodb, and +--with-libodb-<database> configure options to specify their locations, +for example: ./configure --with-libodb=/tmp/libodb @@ -110,8 +109,8 @@ Cygwin or MinGW, refer to the "Building on UNIX" section above. The standard Visual Studio project and solution files are used on this platform. The provided project files expect the directory where the ODB compiler binary is installed to be in the executable search path (the -PATH environment variable). They also expect the libodb, libodb-tracer, -and libodb-<database> header and import library directories to be in the +PATH environment variable). They also expect the libodb and +libodb-<database> header and import library directories to be in the VC++ Directories Include and Library search lists. See the INSTALL files in the ODB library packages for more information on how to setup their VC++ Directories. @@ -127,13 +126,13 @@ Qt, refer to their documentation. There are two ways to build the tests with Visual Studio. After unpacking the source code archive, you can manually open solution files located in -the tracer\, common\, <database>\, boost\common\, boost\<database>\, +the libcommon\, common\, <database>\, boost\common\, boost\<database>\, qt\common\, and qt\<database>\ directories in the odb-tests package -directory (referred to as odb-tests\ from now on). In the tracer\ directory -the solution file is named tracer-vc<N>.sln. In the common\, boost\common\, -and qt\common\ directories they are named common-<database>-vc<N>.sln. And -in the <database>\, boost\<database>\, and qt\<database> directories they -are named <database>-vc<N>.sln. Here <N> is the version of Visual Studio +directory (referred to as odb-tests\ from now on). In the libcommon\, +common\, boost\common\, and qt\common\ directories the solutions are +named in the form name-<database>-vc<N>.sln. And in the <database>\, +boost\<database>\, and qt\<database>\ directories they are named in +the form <database>-vc<N>.sln. Here <N> is the version of Visual Studio that you are using. Once each solution is open, select the desired build configuration (Debug or Release) and platform (Win32 or x64) and build the solution. @@ -147,10 +146,10 @@ build.bat <database> <N> <conf> <plat> [/Build|/Clean|/Rebuild] Where <N> is the version of Visual Studio that you are using, <conf> is the desired configuration (e.g., Debug or Release), and <plat> is the desired -platform (e.g., Win32 or x64). For <conf> and <plat> arguments you can specify -several configurations or platforms. You can also use the 'all' value to build -all configurations and/or all platforms. If no action is specified, the -default is /Build. +platform (e.g., Win32 or x64). For <conf> and <plat> arguments you can +specify several configurations or platforms. You can also use the 'all' +value to build all configurations and/or all platforms. If no action is +specified, the default is /Build. Once the build is completed successfully, you can run all the tests using the test.bat batch file located in the odb-tests\ directory. diff --git a/Makefile.am b/Makefile.am index 09198da..9c56178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ # copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file -SUBDIRS = libcommon tracer common +SUBDIRS = libcommon common if ODB_TESTS_BOOST SUBDIRS += boost @@ -79,14 +79,6 @@ for %%c in (%confs%) do ( ) ) -for %%d in (tracer %1) do ( - for %%c in (%confs%) do ( - for %%p in (%plats%) do ( - call :run_build %%d/%%d-vc%vcver%.sln %%c %%p - ) - ) -) - for %%c in (%confs%) do ( for %%p in (%plats%) do ( call :run_build common/common-%1-vc%vcver%.sln %%c %%p diff --git a/build/import/libodb-tracer/LICENSE b/build/import/libodb-tracer/LICENSE deleted file mode 100644 index ed9c55c..0000000 --- a/build/import/libodb-tracer/LICENSE +++ /dev/null @@ -1,12 +0,0 @@ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/build/import/libodb-tracer/configuration-rules.make b/build/import/libodb-tracer/configuration-rules.make deleted file mode 100644 index 2780987..0000000 --- a/build/import/libodb-tracer/configuration-rules.make +++ /dev/null @@ -1,15 +0,0 @@ -# file : build/import/libodb-tracer/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : GNU GPL v2; see accompanying LICENSE file - -$(dcf_root)/import/libodb-tracer/configuration-dynamic.make: | $(dcf_root)/import/libodb-tracer/. - $(call message,,$(scf_root)/import/libodb-tracer/configure $@) - -ifndef %foreign% - -$(dcf_root)/.disfigure:: - $(call message,rm $(dcf_root)/import/libodb-tracer/configuration-dynamic.make,\ -rm -f $(dcf_root)/import/libodb-tracer/configuration-dynamic.make) - -endif diff --git a/build/import/libodb-tracer/configure b/build/import/libodb-tracer/configure deleted file mode 100755 index 644b804..0000000 --- a/build/import/libodb-tracer/configure +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env bash - -# file : build/import/libodb-tracer/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : GNU GPL v2; see accompanying LICENSE file - - -# $1 - out file -# -# bld_root - build root -# project_name - project name -# - -source $bld_root/dialog.bash - - -$echo -$echo "Configuring external dependency on 'libodb-tracer' for '$project_name'." -$echo - -$echo -$echo "Would you like to configure dependency on the installed version" -$echo "of 'libodb-tracer' as opposed to the development build?" -$echo - -installed=`read_y_n y` - -path= - -if [ "$installed" = "n" ]; then - -$echo -$echo "Please enter the src_root for 'libodb-tracer'." -$echo - -src_root=`read_path --directory --exist` - -$echo -$echo "Please enter the out_root for 'libodb-tracer'." -$echo - -out_root=`read_path --directory $src_root` - -fi - -echo libodb_tracer_installed := $installed >$1 - -if [ "$installed" = "n" ]; then - -echo src_root := $src_root >>$1 -echo scf_root := \$\(src_root\)/build >>$1 -echo out_root := $out_root >>$1 - -fi diff --git a/build/import/libodb-tracer/stub.make b/build/import/libodb-tracer/stub.make deleted file mode 100644 index 8d4bb96..0000000 --- a/build/import/libodb-tracer/stub.make +++ /dev/null @@ -1,30 +0,0 @@ -# file : build/import/libodb-tracer/stub.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : GNU GPL v2; see accompanying LICENSE file - -$(call include-once,$(scf_root)/import/libodb-tracer/configuration-rules.make,$(dcf_root)) - -libodb_tracer_installed := - -$(call -include,$(dcf_root)/import/libodb-tracer/configuration-dynamic.make) - -ifdef libodb_tracer_installed - -ifeq ($(libodb_tracer_installed),y) - -$(call export,l: -lodb-tracer -lodb,cpp-options: ) - -else - -# Include export stub. -# -$(call include,$(scf_root)/export/libodb-tracer/stub.make) - -endif - -else - -.NOTPARALLEL: - -endif diff --git a/tracer/include/driver.cxx b/common/include/driver.cxx index f2f9382..d588a62 100644 --- a/tracer/include/driver.cxx +++ b/common/include/driver.cxx @@ -1,4 +1,4 @@ -// file : tracer/include/driver.cxx +// file : common/include/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 @@ -18,7 +18,8 @@ #include <odb/exceptions.hxx> #include <odb/transaction.hxx> -#include <odb/tracer/database.hxx> + +#include <common/common.hxx> #include "test1.hxx" #include "test1-odb.hxx" diff --git a/tracer/include/makefile b/common/include/makefile index a7f7089..7053d75 100644 --- a/tracer/include/makefile +++ b/common/include/makefile @@ -1,4 +1,4 @@ -# file : tracer/include/makefile +# file : common/include/makefile # author : Boris Kolpackov <boris@codesynthesis.com> # copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file @@ -10,6 +10,9 @@ odb_hdr := obj1.hxx obj2.hxx obj3.hxx test1.hxx test2.hxx test3.hxx test4.hxx cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o)) cxx_od := $(cxx_obj:.o=.o.d) +common.l := $(out_root)/libcommon/common/common.l +common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options + driver := $(out_base)/driver dist := $(out_base)/.dist test := $(out_base)/.test @@ -21,29 +24,22 @@ $(call import,\ $(scf_root)/import/odb/stub.make,\ odb: odb,odb-rules: odb_rules) -$(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) +$(driver): $(cxx_obj) $(common.l) $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) \ -I$(out_base)/../.. -I$(src_base)/../.. -$(cxx_obj) $(cxx_od): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options) +$(cxx_obj) $(cxx_od): $(common.l.cpp-options) genf := $(foreach f,$(odb_hdr:.hxx=-odb),$(addprefix $f,.hxx .ixx .cxx)) gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) -$(gen): odb_options += --database tracer +$(gen) $(dist): export odb_options += --database $(db_id) \ +--table-prefix include_ $(gen): cpp_options := -I$(out_base) -I$(src_base)/.. -I$(src_base)/../.. -$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options) +$(gen): $(common.l.cpp-options) $(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) @@ -58,7 +54,8 @@ $(dist): # Test. # $(test): $(driver) $(src_base)/test.std - $(call message,test $<,$< >$(out_base)/test.out) + $(call message,test $<,$< --options-file $(dcf_root)/db.options \ +>$(out_base)/test.out) $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out) $(call message,,rm -f $(out_base)/test.out) @@ -88,3 +85,7 @@ $(call include,$(odb_rules)) $(call include,$(bld_root)/cxx/cxx-d.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/o-e.make) + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/tracer/include/obj1.hxx b/common/include/obj1.hxx index ef2429b..cdf6a66 100644 --- a/tracer/include/obj1.hxx +++ b/common/include/obj1.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/obj1.hxx +// file : common/include/obj1.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/obj2.hxx b/common/include/obj2.hxx index 71018a8..4c98d7d 100644 --- a/tracer/include/obj2.hxx +++ b/common/include/obj2.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/obj2.hxx +// file : common/include/obj2.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/obj3.hxx b/common/include/obj3.hxx index 92bdc0b..b73673a 100644 --- a/tracer/include/obj3.hxx +++ b/common/include/obj3.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/obj3.hxx +// file : common/include/obj3.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/objs1.hxx b/common/include/objs1.hxx index 98c0f2f..5e592a4 100644 --- a/tracer/include/objs1.hxx +++ b/common/include/objs1.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/objs1.hxx +// file : common/include/objs1.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/objs2.hxx b/common/include/objs2.hxx index c19811a..f2cfee0 100644 --- a/tracer/include/objs2.hxx +++ b/common/include/objs2.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/objs2.hxx +// file : common/include/objs2.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/objs3.hxx b/common/include/objs3.hxx index b8828de..d9bc01a 100644 --- a/tracer/include/objs3.hxx +++ b/common/include/objs3.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/objs3.hxx +// file : common/include/objs3.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/objs4.hxx b/common/include/objs4.hxx index 7f76aea..fc5f1de 100644 --- a/tracer/include/objs4.hxx +++ b/common/include/objs4.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/objs1.hxx +// file : common/include/objs1.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file @@ -6,8 +6,8 @@ #ifndef OBJS4_HXX #define OBJS4_HXX -#include <tracer/include/obj1.hxx> -#include <tracer/include/obj2.hxx> -#include <tracer/include/obj3.hxx> +#include <common/include/obj1.hxx> +#include <common/include/obj2.hxx> +#include <common/include/obj3.hxx> #endif // OBJS4_HXX diff --git a/tracer/include/test.std b/common/include/test.std index e69de29..e69de29 100644 --- a/tracer/include/test.std +++ b/common/include/test.std diff --git a/tracer/include/test1.hxx b/common/include/test1.hxx index 6f08900..15972c1 100644 --- a/tracer/include/test1.hxx +++ b/common/include/test1.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/test1.hxx +// file : common/include/test1.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file @@ -11,7 +11,7 @@ #include"obj1.hxx" # include \ - <tracer/include/obj2.hxx> + <common/include/obj2.hxx> /*comment*/ # /*comment*/ include /* comment */ "obj3.hxx" // comment diff --git a/tracer/include/test2.hxx b/common/include/test2.hxx index 74623d4..ee26994 100644 --- a/tracer/include/test2.hxx +++ b/common/include/test2.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/test2.hxx +// file : common/include/test2.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/test3.hxx b/common/include/test3.hxx index 3f1b762..a2b2096 100644 --- a/tracer/include/test3.hxx +++ b/common/include/test3.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/test3.hxx +// file : common/include/test3.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/tracer/include/test4.hxx b/common/include/test4.hxx index 8ea681a..49180bc 100644 --- a/tracer/include/test4.hxx +++ b/common/include/test4.hxx @@ -1,4 +1,4 @@ -// file : tracer/include/test3.hxx +// file : common/include/test3.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file diff --git a/common/lifecycle/driver.cxx b/common/lifecycle/driver.cxx index 46d145b..8323694 100644 --- a/common/lifecycle/driver.cxx +++ b/common/lifecycle/driver.cxx @@ -28,6 +28,18 @@ main (int argc, char* argv[]) { auto_ptr<database> db (create_database (argc, argv)); + // Database operation out of transaction. + // + try + { + object o (1); + db->persist (o); + assert (false); + } + catch (const not_in_transaction&) + { + } + // Transient. // try @@ -63,11 +75,100 @@ main (int argc, char* argv[]) } } + // Find. + // + { + transaction t (db->begin ()); + + auto_ptr<object> o1 (db->find<object> (1)); + assert (o1.get () != 0 && o1->str_ == "value 1"); + + auto_ptr<object> o2 (db->find<object> (2)); + assert (o2.get () == 0); + + t.commit (); + } + + // Find (into existing). + // + { + object o; + + transaction t (db->begin ()); + + assert (db->find (1, o)); + assert (o.str_ == "value 1"); + + assert (!db->find (2, o)); + + t.commit (); + } + + // Load. + // { transaction t (db->begin ()); auto_ptr<object> o (db->load<object> (1)); assert (o->str_ == "value 1"); t.commit (); + + try + { + transaction t (db->begin ()); + auto_ptr<object> o (db->load<object> (2)); + assert (false); + t.commit (); + } + catch (const object_not_persistent&) + { + } + } + + // Load (into existing). + // + { + object o; + + transaction t (db->begin ()); + db->load (1, o); + assert (o.str_ == "value 1"); + t.commit (); + + try + { + transaction t (db->begin ()); + db->load (2, o); + assert (false); + t.commit (); + } + catch (const object_not_persistent&) + { + } + } + + // Reload. + // + { + object o; + + transaction t (db->begin ()); + db->load (1, o); + o.str_ = "junk"; + db->reload (o); + assert (o.str_ == "value 1"); + t.commit (); + + try + { + transaction t (db->begin ()); + o.id_ = 2; + db->reload (o); + assert (false); + t.commit (); + } + catch (const object_not_persistent&) + { + } } // Modified. @@ -78,6 +179,18 @@ main (int argc, char* argv[]) o->str_ = "value 2"; db->update (*o); t.commit (); + + try + { + transaction t (db->begin ()); + o->id_ = 2; + db->update (*o); + assert (false); + t.commit (); + } + catch (const object_not_persistent&) + { + } } { @@ -103,6 +216,17 @@ main (int argc, char* argv[]) auto_ptr<object> o (db->load<object> (1)); db->erase (*o); t.commit (); + + try + { + transaction t (db->begin ()); + db->erase<object> (1); + assert (false); + t.commit (); + } + catch (const object_not_persistent&) + { + } } try diff --git a/common/makefile b/common/makefile index 37d50d3..c75ea56 100644 --- a/common/makefile +++ b/common/makefile @@ -17,18 +17,21 @@ ctor \ default \ enum \ erase-query \ +include \ inheritance \ inverse \ lazy-ptr \ lifecycle \ no-id \ optimistic \ +pragma \ query \ readonly \ relationship \ relationship-query \ schema \ template \ +types \ view \ wrapper diff --git a/tracer/pragma/driver.cxx b/common/pragma/driver.cxx index 2f89ad5..65b384d 100644 --- a/tracer/pragma/driver.cxx +++ b/common/pragma/driver.cxx @@ -1,4 +1,4 @@ -// file : tracer/pragma/driver.cxx +// file : common/pragma/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 @@ -12,7 +12,8 @@ #include <odb/exceptions.hxx> #include <odb/transaction.hxx> -#include <odb/tracer/database.hxx> + +#include <common/common.hxx> #include "test.hxx" #include "test-odb.hxx" diff --git a/tracer/types/makefile b/common/pragma/makefile index 2a7ceb5..449fcaf 100644 --- a/tracer/types/makefile +++ b/common/pragma/makefile @@ -1,4 +1,4 @@ -# file : tracer/types/makefile +# file : common/pragma/makefile # author : Boris Kolpackov <boris@codesynthesis.com> # copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file @@ -10,6 +10,9 @@ odb_hdr := test.hxx cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o)) cxx_od := $(cxx_obj:.o=.o.d) +common.l := $(out_root)/libcommon/common/common.l +common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options + driver := $(out_base)/driver dist := $(out_base)/.dist test := $(out_base)/.test @@ -21,28 +24,21 @@ $(call import,\ $(scf_root)/import/odb/stub.make,\ odb: odb,odb-rules: odb_rules) -$(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) +$(driver): $(cxx_obj) $(common.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) +$(cxx_obj) $(cxx_od): $(common.l.cpp-options) -genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) +genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql) gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database tracer +$(gen) $(dist): export odb_options += --database $(db_id) \ +--table-prefix pragma_ $(gen): cpp_options := -I$(src_base) -$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options) +$(gen): $(common.l.cpp-options) $(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) @@ -52,22 +48,26 @@ $(out_base)/: $(driver) # Dist # +name := $(subst /,-,$(subst $(src_root)/common/,,$(src_base))) + +$(dist): db_id := @database@ $(dist): sources := $(cxx_tun) $(dist): headers := $(odb_hdr) $(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): export name := $(name) +$(dist): export extra_dist := $(data_dist) $(call vc9projs,$(name)) \ +$(call vc10projs,$(name)) $(dist): $(call dist-data,$(sources) $(headers) $(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) + $(call meta-vc9projs,../template/template,$(name)) + $(call meta-vc10projs,../template/template,$(name)) # Test. # $(test): $(driver) $(src_base)/test.std - $(call message,test $<,$< >$(out_base)/test.out) + $(call message,test $<,$< --options-file $(dcf_root)/db.options \ +>$(out_base)/test.out) $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out) $(call message,,rm -f $(out_base)/test.out) @@ -102,3 +102,7 @@ $(call include,$(odb_rules)) $(call include,$(bld_root)/cxx/cxx-d.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/o-e.make) + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/tracer/pragma/test.hxx b/common/pragma/test.hxx index 46f251e..d7f21b0 100644 --- a/tracer/pragma/test.hxx +++ b/common/pragma/test.hxx @@ -1,4 +1,4 @@ -// file : tracer/template/test.hxx +// file : common/template/test.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file @@ -8,7 +8,7 @@ #include <odb/core.hxx> -#pragma db value(bool) type ("INT") +#pragma db value(bool) type ("INTEGER") struct x {int i;}; #pragma db value (x) @@ -23,7 +23,7 @@ namespace N #pragma db id unsigned long id_; - #pragma db member type ("INT") + #pragma db member type ("INTEGER") bool b_; }; diff --git a/tracer/pragma/test.std b/common/pragma/test.std index e69de29..e69de29 100644 --- a/tracer/pragma/test.std +++ b/common/pragma/test.std diff --git a/tracer/types/driver.cxx b/common/types/driver.cxx index 9c1b97d..11e15d7 100644 --- a/tracer/types/driver.cxx +++ b/common/types/driver.cxx @@ -1,4 +1,4 @@ -// file : tracer/types/driver.cxx +// file : common/types/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 @@ -10,6 +10,8 @@ #include <cassert> #include <iostream> +#include <common/common.hxx> + #include "test.hxx" #include "test-odb.hxx" diff --git a/tracer/object/makefile b/common/types/makefile index bd0efca..4081ee8 100644 --- a/tracer/object/makefile +++ b/common/types/makefile @@ -1,4 +1,4 @@ -# file : tracer/object/makefile +# file : common/types/makefile # author : Boris Kolpackov <boris@codesynthesis.com> # copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file @@ -10,6 +10,9 @@ odb_hdr := test.hxx cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o)) cxx_od := $(cxx_obj:.o=.o.d) +common.l := $(out_root)/libcommon/common/common.l +common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options + driver := $(out_base)/driver dist := $(out_base)/.dist test := $(out_base)/.test @@ -21,28 +24,20 @@ $(call import,\ $(scf_root)/import/odb/stub.make,\ odb: odb,odb-rules: odb_rules) -$(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) +$(driver): $(cxx_obj) $(common.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) +$(cxx_obj) $(cxx_od): $(common.l.cpp-options) -genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) +genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql) gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database tracer +$(gen) $(dist): export odb_options += --database $(db_id) --table-prefix types_ $(gen): cpp_options := -I$(src_base) -$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options) +$(gen): $(common.l.cpp-options) $(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) @@ -52,22 +47,26 @@ $(out_base)/: $(driver) # Dist # +name := $(subst /,-,$(subst $(src_root)/common/,,$(src_base))) + +$(dist): db_id := @database@ $(dist): sources := $(cxx_tun) $(dist): headers := $(odb_hdr) $(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): export name := $(name) +$(dist): export extra_dist := $(data_dist) $(call vc9projs,$(name)) \ +$(call vc10projs,$(name)) $(dist): $(call dist-data,$(sources) $(headers) $(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) + $(call meta-vc9projs,../template/template,$(name)) + $(call meta-vc10projs,../template/template,$(name)) # Test. # $(test): $(driver) $(src_base)/test.std - $(call message,test $<,$< >$(out_base)/test.out) + $(call message,test $<,$< --options-file $(dcf_root)/db.options \ +>$(out_base)/test.out) $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out) $(call message,,rm -f $(out_base)/test.out) @@ -102,3 +101,7 @@ $(call include,$(odb_rules)) $(call include,$(bld_root)/cxx/cxx-d.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/o-e.make) + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/tracer/types/test.hxx b/common/types/test.hxx index c37692b..858f403 100644 --- a/tracer/types/test.hxx +++ b/common/types/test.hxx @@ -1,4 +1,4 @@ -// file : tracer/types/test.hxx +// file : common/types/test.hxx // author : Boris Kolpackov <boris@codesynthesis.com> // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file @@ -6,8 +6,6 @@ #ifndef TEST_HXX #define TEST_HXX -#include <iosfwd> - #ifdef ODB_COMPILER typedef int int_t; typedef short num_t; @@ -39,30 +37,20 @@ template <typename X> struct num_wrap { #ifdef ODB_COMPILER - typedef num_wrap this_type; + typedef num_wrap this_type; // Name that we should not use. #endif + num_wrap () {} + num_wrap (X v): v_ (v) {} + operator X () const {return v_;} + X v_; }; -template <typename X> -std::ostream& -operator<< (std::ostream& os, const num_wrap<X>& x) -{ - return os << x.v_; -} - -template <typename X> -bool -operator== (const num_wrap<X>& x, const num_wrap<X>& y) -{ - return x.v_ == y.v_; -} - #pragma db object struct object3 { - #pragma db id + #pragma db id type("INTEGER") num_wrap<int> num_; }; diff --git a/tracer/types/test.std b/common/types/test.std index e69de29..e69de29 100644 --- a/tracer/types/test.std +++ b/common/types/test.std diff --git a/configure.ac b/configure.ac index ff877d8..26ae26d 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AC_PREREQ(2.60) AC_INIT([odb-tests], [__value__(version)], [odb-users@codesynthesis.com]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([tracer/template/driver.cxx]) +AC_CONFIG_SRCDIR([common/template/driver.cxx]) AM_INIT_AUTOMAKE([-Wall -Werror foreign nostdinc subdir-objects dist-bzip2 dist-zip tar-ustar]) @@ -33,7 +33,6 @@ AM_CONDITIONAL([ODB_TESTS_THREADS], [test x$threads != xnone]) # Check for the ODB libs. # LIBODB([], [AC_MSG_ERROR([libodb is not found; consider using --with-libodb=DIR])]) -LIBODB_TRACER([], [AC_MSG_ERROR([libodb-tracer is not found; consider using --with-libodb-tracer=DIR])]) # Check for TR1 <memory> availability. # diff --git a/m4/libodb-tracer.m4 b/m4/libodb-tracer.m4 deleted file mode 100644 index 4cc2265..0000000 --- a/m4/libodb-tracer.m4 +++ /dev/null @@ -1,84 +0,0 @@ -dnl file : m4/libodb-tracer.m4 -dnl author : Boris Kolpackov <boris@codesynthesis.com> -dnl copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -dnl license : GNU GPL v2; see accompanying LICENSE file -dnl -dnl LIBODB_TRACER([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -dnl -dnl -AC_DEFUN([LIBODB_TRACER], [ -libodb_tracer_found=no - -AC_ARG_WITH( - [libodb-tracer], - [AC_HELP_STRING([--with-libodb-tracer=DIR],[location of libodb-tracer build directory])], - [libodb_tracer_dir=${withval}], - [libodb_tracer_dir=]) - -AC_MSG_CHECKING([for libodb-tracer]) - -# If libodb_tracer_dir was given, add the necessary preprocessor and -# linker flags. -# -if test x"$libodb_tracer_dir" != x; then - save_CPPFLAGS="$CPPFLAGS" - save_LDFLAGS="$LDFLAGS" - - AS_SET_CATFILE([abs_libodb_tracer_dir], [$ac_pwd], [$libodb_tracer_dir]) - - CPPFLAGS="$CPPFLAGS -I$abs_libodb_tracer_dir" - LDFLAGS="$LDFLAGS -L$abs_libodb_tracer_dir/odb/tracer" -fi - -save_LIBS="$LIBS" -LIBS="-lodb-tracer $LIBS" - -CXX_LIBTOOL_LINK_IFELSE( -AC_LANG_SOURCE([[ -#include <odb/tracer/exceptions.hxx> - -void -f () -{ -} - -const char* -g () -{ - try - { - f (); - } - catch (const odb::tracer::database_exception& e) - { - return e.what (); - } - return 0; -} - -int -main () -{ - const char* m (g ()); - return m != 0; -} -]]), -[libodb_tracer_found=yes]) - -if test x"$libodb_tracer_found" = xno; then - LIBS="$save_LIBS" - - if test x"$libodb_tracer_dir" != x; then - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - fi -fi - -if test x"$libodb_tracer_found" = xyes; then - AC_MSG_RESULT([yes]) - $1 -else - AC_MSG_RESULT([no]) - $2 -fi -])dnl @@ -5,8 +5,8 @@ include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make -all_dirs := libcommon common tracer mysql sqlite pgsql oracle boost qt -dirs := common tracer boost qt +all_dirs := libcommon common mysql sqlite pgsql oracle boost qt +dirs := common boost qt ifeq ($(db_id),mysql) dirs += mysql @@ -23,8 +23,8 @@ endif # @@ Remove overrides when Oracle implementation is complete. # ifeq ($(db_id),oracle) -all_dirs := libcommon common tracer mysql sqlite pgsql oracle boost -dirs := common tracer boost oracle +all_dirs := libcommon common mysql sqlite pgsql oracle boost +dirs := common boost oracle endif default := $(out_base)/ @@ -45,7 +45,7 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_dirs))) $(call dist-data,$(data_dist)) $(call dist-exec,$(exec_dist)) $(call dist-dir,m4) - $(call meta-vctest,tracer/tracer-vc10.sln,build.bat) + $(call meta-vctest,libcommon/libcommon-mysql-vc10.sln,build.bat) $(call meta-automake) $(call meta-autoconf) @@ -39,7 +39,7 @@ goto :eof :start -for %%d in (tracer common %1 boost\common boost\%1 qt\common qt\%1) do ( +for %%d in (common %1 boost\common boost\%1 qt\common qt\%1) do ( call :run_test %%d %1 ) diff --git a/tracer/Makefile.am b/tracer/Makefile.am deleted file mode 100644 index acaf926..0000000 --- a/tracer/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# file : tracer/Makefile.am -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : GNU GPL v2; see accompanying LICENSE file - -SUBDIRS = __path__(dirs) -EXTRA_DIST = __file__(extra_dist)
\ No newline at end of file diff --git a/tracer/makefile b/tracer/makefile deleted file mode 100644 index e566c59..0000000 --- a/tracer/makefile +++ /dev/null @@ -1,41 +0,0 @@ -# file : tracer/makefile -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : GNU GPL; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make - -tests := \ -template \ -object \ -include \ -pragma \ -transaction \ -types - -default := $(out_base)/ -dist := $(out_base)/.dist -test := $(out_base)/.test -clean := $(out_base)/.clean - -$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) - -$(dist): name := tracer -$(dist): export dirs := $(filter-out include,$(tests)) -$(dist): export extra_dist := $(name)-vc9.sln $(name)-vc10.sln test.bat -$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(tests))) - $(call meta-automake) - $(call meta-vc9sln,$(name)-vc9.sln) - $(call meta-vc10sln,$(name)-vc10.sln) - $(call meta-vctest,$(name)-vc10.sln,test.bat) - - -$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests))) -$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests))) - -$(call include,$(bld_root)/meta/vc9sln.make) -$(call include,$(bld_root)/meta/vc10sln.make) -$(call include,$(bld_root)/meta/vctest.make) -$(call include,$(bld_root)/meta/automake.make) - -$(foreach t,$(tests),$(call import,$(src_base)/$t/makefile)) diff --git a/tracer/object/driver.cxx b/tracer/object/driver.cxx deleted file mode 100644 index 4ea6329..0000000 --- a/tracer/object/driver.cxx +++ /dev/null @@ -1,234 +0,0 @@ -// file : tracer/object/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 object persistence operations. -// - -#include <memory> -#include <cassert> -#include <iostream> - -#include <odb/exceptions.hxx> -#include <odb/transaction.hxx> -#include <odb/tracer/database.hxx> - -#include "test.hxx" -#include "test-odb.hxx" - -using namespace std; -using namespace odb::core; - -int -main () -{ - odb::tracer::database db; - - // database operation out of transaction - // - cout << "\ntest 001" << endl; - { - object o1 (1); - try - { - cout << "s 1" << endl; - db.persist (o1); - cout << "s 2.a" << endl; - } - catch (const not_in_transaction&) - { - cout << "s 2.b" << endl; - } - } - - // transient -> persistent - // - cout << "\ntest 002" << endl; - { - object o1 (1); - transaction t (db.begin ()); - cout << "s 1" << endl; - db.persist (o1); - cout << "s 2" << endl; - t.commit (); - cout << "s 3" << endl; - } - - // transient -> persistent (already exist) - // - cout << "\ntest 003" << endl; - { - object o1 (0); - transaction t (db.begin ()); - cout << "s 1" << endl; - try - { - db.persist (o1); - } - catch (const object_already_persistent&) - { - cout << "object already persistent" << endl; - } - cout << "s 2" << endl; - } - - // persistent -> transient - // - cout << "\ntest 004" << endl; - { - object o1 (1); - object o2 (2); - transaction t (db.begin ()); - cout << "s 1" << endl; - db.persist (o1); - db.persist (o2); - cout << "s 2" << endl; - db.erase (o1); - db.erase<object> (2); - cout << "s 3" << endl; - t.commit (); - cout << "s 4" << endl; - } - - // persistent -> transient (not exist) - // - cout << "\ntest 005" << endl; - { - object o1 (0); - transaction t (db.begin ()); - cout << "s 1" << endl; - try - { - db.erase (o1); - } - catch (const object_not_persistent&) - { - cout << "object not persistent" << endl; - } - cout << "s 2" << endl; - } - - // load new object - // - cout << "\ntest 006" << endl; - { - transaction t (db.begin ()); - cout << "s 1" << endl; - auto_ptr<object> o1 (db.load<object> (1)); - cout << "s 2" << endl; - t.commit (); - cout << "s 3" << endl; - } - - // load new object (not exist) - // - cout << "\ntest 007" << endl; - { - transaction t (db.begin ()); - cout << "s 1" << endl; - try - { - auto_ptr<object> o1 (db.load<object> (0)); - } - catch (const object_not_persistent&) - { - cout << "object not persistent" << endl; - } - cout << "s 2" << endl; - } - - // load into existing object - // - cout << "\ntest 008" << endl; - { - object o1; - transaction t (db.begin ()); - cout << "s 1" << endl; - db.load (1, o1); - cout << "s 2" << endl; - t.commit (); - cout << "s 3" << endl; - } - - // load into existing object (not exist) - // - cout << "\ntest 009" << endl; - { - object o1; - transaction t (db.begin ()); - cout << "s 1" << endl; - try - { - db.load (0, o1); - } - catch (const object_not_persistent&) - { - cout << "object not persistent" << endl; - } - cout << "s 2" << endl; - } - - // update - // - cout << "\ntest 010" << endl; - { - transaction t (db.begin ()); - cout << "s 1" << endl; - auto_ptr<object> o1 (db.load<object> (1)); - cout << "s 2" << endl; - db.update (*o1); - cout << "s 3" << endl; - t.commit (); - cout << "s 4" << endl; - } - - // update (not exist) - // - cout << "\ntest 011" << endl; - { - object o1 (0); - transaction t (db.begin ()); - cout << "s 1" << endl; - try - { - db.update (o1); - } - catch (const object_not_persistent&) - { - cout << "object not persistent" << endl; - } - cout << "s 2" << endl; - } - - // find new object - // - cout << "\ntest 012" << endl; - { - transaction t (db.begin ()); - cout << "s 1" << endl; - auto_ptr<object> o1 (db.find<object> (1)); - assert (o1.get () != 0); - auto_ptr<object> o2 (db.find<object> (0)); - assert (o2.get () == 0); - cout << "s 2" << endl; - t.commit (); - cout << "s 3" << endl; - } - - // load into existing object - // - cout << "\ntest 013" << endl; - { - object o1; - transaction t (db.begin ()); - cout << "s 1" << endl; - bool r (db.find (1, o1)); - assert (r); - r = db.find (0, o1); - assert (!r); - cout << "s 2" << endl; - t.commit (); - cout << "s 3" << endl; - } -} diff --git a/tracer/object/test.hxx b/tracer/object/test.hxx deleted file mode 100644 index 38bbd7f..0000000 --- a/tracer/object/test.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// file : tracer/object/test.hxx -// author : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST_HXX -#define TEST_HXX - -#include <odb/core.hxx> - -#pragma db object -struct object -{ - object (unsigned long id) - : id_ (id) - { - } - - object () - { - } - - #pragma db id - unsigned long id_; -}; - -#endif // TEST_HXX diff --git a/tracer/object/test.std b/tracer/object/test.std deleted file mode 100644 index aa495e7..0000000 --- a/tracer/object/test.std +++ /dev/null @@ -1,108 +0,0 @@ - -test 001 -s 1 -s 2.b - -test 002 -begin transaction -s 1 -insert ::object id 1 -s 2 -commit transaction -s 3 - -test 003 -begin transaction -s 1 -insert ::object id 0 -object already persistent -s 2 -rollback transaction - -test 004 -begin transaction -s 1 -insert ::object id 1 -insert ::object id 2 -s 2 -delete ::object id 1 -delete ::object id 2 -s 3 -commit transaction -s 4 - -test 005 -begin transaction -s 1 -delete ::object id 0 -object not persistent -s 2 -rollback transaction - -test 006 -begin transaction -s 1 -select ::object id 1 -s 2 -commit transaction -s 3 - -test 007 -begin transaction -s 1 -select ::object id 0 -object not persistent -s 2 -rollback transaction - -test 008 -begin transaction -s 1 -select ::object id 1 -s 2 -commit transaction -s 3 - -test 009 -begin transaction -s 1 -select ::object id 0 -object not persistent -s 2 -rollback transaction - -test 010 -begin transaction -s 1 -select ::object id 1 -s 2 -update ::object id 1 -s 3 -commit transaction -s 4 - -test 011 -begin transaction -s 1 -update ::object id 0 -object not persistent -s 2 -rollback transaction - -test 012 -begin transaction -s 1 -select ::object id 1 -select ::object id 0 -s 2 -commit transaction -s 3 - -test 013 -begin transaction -s 1 -select ::object id 1 -select ::object id 0 -s 2 -commit transaction -s 3 diff --git a/tracer/pragma/makefile b/tracer/pragma/makefile deleted file mode 100644 index 688c6e1..0000000 --- a/tracer/pragma/makefile +++ /dev/null @@ -1,104 +0,0 @@ -# file : tracer/pragma/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 -odb_hdr := test.hxx -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.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/odb/stub.make,\ - odb: odb,odb-rules: odb_rules) - -$(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) - -genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): $(odb) -$(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database tracer -$(gen): cpp_options := -I$(src_base) -$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options) - -$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) - -# Alias for default target. -# -$(out_base)/: $(driver) - -# Dist -# -$(dist): sources := $(cxx_tun) -$(dist): headers := $(odb_hdr) -$(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) $(headers) $(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)) \ - $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean)) - $(call message,,rm -f $(out_base)/test.out) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(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,$(odb_rules)) -$(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/template/Makefile.am b/tracer/template/Makefile.am deleted file mode 100644 index 4305788..0000000 --- a/tracer/template/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# file : tracer/template/Makefile.am -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : GNU GPL v2; see accompanying LICENSE file - -EXTRA_DIST = __file__(extra_dist) - -noinst_PROGRAMS = driver -driver_SOURCES = driver.cxx __path__(extra_sources) __path__(extra_headers) -AM_CPPFLAGS = -I'$(top_builddir)/libcommon' -I'$(top_srcdir)/libcommon' -AM_CPPFLAGS += -I'$(builddir)' -I'$(srcdir)' - -TESTS=$(top_builddir)/tester -TESTS_ENVIRONMENT=top_builddir=$(top_builddir); export top_builddir; - -m4_ifelse(__value__(odb_options),,, - -# ODB compilation. -# -driver_SOURCES += test.hxx -nodist_driver_SOURCES = test-odb.cxx -BUILT_SOURCES = test-odb.hxx -CLEANFILES = test-odb.hxx test-odb.ixx test-odb.cxx - -ODB = @ODB@ -ODBFLAGS = @ODBFLAGS@ -ODBCPPFLAGS = @ODBCPPFLAGS@ - -test-odb.hxx: test.hxx - $(ODB) $(AM_CPPFLAGS) $(ODBCPPFLAGS) $(CPPFLAGS) $(ODBFLAGS) __value__(odb_options) $< -) diff --git a/tracer/template/driver.cxx b/tracer/template/driver.cxx deleted file mode 100644 index e63fae6..0000000 --- a/tracer/template/driver.cxx +++ /dev/null @@ -1,35 +0,0 @@ -// file : tracer/template/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 - -// PLACE TEST DESCRIPTION HERE -// - -#include <memory> -#include <cassert> -#include <iostream> - -#include <odb/exceptions.hxx> -#include <odb/transaction.hxx> -#include <odb/tracer/database.hxx> - -#include "test.hxx" -#include "test-odb.hxx" - -using namespace std; -using namespace odb::core; - -int -main () -{ - odb::tracer::database db; - - // - // - cout << "test 001" << endl; - { - transaction t (db.begin ()); - t.commit (); - } -} diff --git a/tracer/template/makefile b/tracer/template/makefile deleted file mode 100644 index e527f3d..0000000 --- a/tracer/template/makefile +++ /dev/null @@ -1,104 +0,0 @@ -# file : tracer/template/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 -odb_hdr := test.hxx -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.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/odb/stub.make,\ - odb: odb,odb-rules: odb_rules) - -$(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) - -genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): $(odb) -$(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database tracer -$(gen): cpp_options := -I$(src_base) -$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options) - -$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) - -# Alias for default target. -# -$(out_base)/: $(driver) - -# Dist -# -$(dist): sources := $(cxx_tun) -$(dist): headers := $(odb_hdr) -$(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) $(headers) $(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)) \ - $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean)) - $(call message,,rm -f $(out_base)/test.out) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(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,$(odb_rules)) -$(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/template/template-vc10.vcxproj b/tracer/template/template-vc10.vcxproj deleted file mode 100644 index 1bcb4ac..0000000 --- a/tracer/template/template-vc10.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{__uuid__()}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>__value__(name)</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>odb-tracer-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>odb-tracer-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>odb-tracer.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>odb-tracer.lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> -m4_ifelse(__value__(odb_options),,, -m4_dnl - <ItemGroup> -__custom_build_entry__( -test.hxx, -odb test.hxx, -odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -I$(SolutionDir)\..\libcommon)) test.hxx, -test-odb.hxx;test-odb.ixx;test-odb.cxx) - </ItemGroup>) - <ItemGroup> -m4_ifelse(__value__(odb_options),,, -__header_entry__(test-odb.hxx) -__header_entry__(test-odb.ixx)) -__header_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_entry__(driver.cxx) -m4_ifelse(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> diff --git a/tracer/template/template-vc10.vcxproj.filters b/tracer/template/template-vc10.vcxproj.filters deleted file mode 100644 index 951015b..0000000 --- a/tracer/template/template-vc10.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>cxx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>h;hxx;ixx;txx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> -m4_ifelse(__value__(odb_options),,, -__header_filter_entry__(test.hxx) -__header_filter_entry__(test-odb.hxx) -__header_filter_entry__(test-odb.ixx)) -__header_filter_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_filter_entry__(driver.cxx) -m4_ifelse(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx)) -__source_filter_entries__(extra_sources) - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/tracer/template/template-vc9.vcproj b/tracer/template/template-vc9.vcproj deleted file mode 100644 index 8e52acb..0000000 --- a/tracer/template/template-vc9.vcproj +++ /dev/null @@ -1,361 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="__value__(name)" - ProjectGUID="{__uuid__()}" - RootNamespace="__value__(name)" - Keyword="Win32Proj" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="odb-tracer-d.lib odb-d.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="odb-tracer.lib odb.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="odb-tracer-d.lib odb-d.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_VC_H" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="odb-tracer.lib odb.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cxx" - UniqueIdentifier="{__uuid__()}" - > -__source_entry__(driver.cxx) -m4_ifelse(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - </Filter> - <Filter - Name="Header Files" - Filter="h;hxx;ixx;txx" - UniqueIdentifier="{__uuid__()}" - > -m4_ifelse(__value__(odb_options),,, -__file_entry_custom_build__( -test.hxx, -odb test.hxx, -odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -I$(SolutionDir)\..\libcommon)) test.hxx, -test-odb.hxx;test-odb.ixx;test-odb.cxx) -__file_entry__(test-odb.hxx) -__file_entry__(test-odb.ixx)) -__file_entries__(extra_headers) - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/tracer/template/test.hxx b/tracer/template/test.hxx deleted file mode 100644 index 93b7b93..0000000 --- a/tracer/template/test.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// file : tracer/template/test.hxx -// author : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST_HXX -#define TEST_HXX - -#include <odb/core.hxx> - -#pragma db object -struct object -{ - object (unsigned long id) - : id_ (id) - { - } - - object () - { - } - - #pragma db id - unsigned long id_; -}; - -#endif // TEST_HXX diff --git a/tracer/template/test.std b/tracer/template/test.std deleted file mode 100644 index ac654fc..0000000 --- a/tracer/template/test.std +++ /dev/null @@ -1,3 +0,0 @@ -test 001 -begin transaction -commit transaction diff --git a/tracer/test.bat b/tracer/test.bat deleted file mode 100644 index fcae726..0000000 --- a/tracer/test.bat +++ /dev/null @@ -1,70 +0,0 @@ -@echo off -rem file : tracer/test.bat -rem author : Boris Kolpackov <boris@codesynthesis.com> -rem copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -rem license : GNU GPL v2; see accompanying LICENSE file - -setlocal - -set "tests=__path__(dirs)" -set "confs=__path__(configurations)" -set "plats=__path__(platforms)" -set "curdir=%CD%" -set "topdir=%curdir%\.." -set "failed=" - -goto start - -rem -rem %1 - test directory -rem %2 - configuration -rem %3 - platform -rem -:run_test - cd %1 - - if "_%3_" == "_Win32_" ( - set "dir=%2" - ) else ( - set "dir=%3\%2" - ) - - if exist %dir%\driver.exe ( - echo %1\%3\%2 - call %topdir%\tester.bat tracer %2 %3 - if errorlevel 1 ( - set "failed=%failed% %1\%3\%2" - ) - ) - - cd %curdir% -goto :eof - -:start - -for %%t in (%tests%) do ( - for %%c in (%confs%) do ( - for %%p in (%plats%) do ( - call :run_test %%t %%c %%p - ) - ) -) - -if not "_%failed%_" == "__" goto error - -echo. -echo ALL TESTS PASSED -echo. -goto end - -:error -if not "_%failed%_" == "__" ( - echo. - for %%t in (%failed%) do echo FAILED: %%t - echo. -) -endlocal -exit /b 1 - -:end -endlocal diff --git a/tracer/tracer-vc10.sln b/tracer/tracer-vc10.sln deleted file mode 100644 index 9a5dc32..0000000 --- a/tracer/tracer-vc10.sln +++ /dev/null @@ -1,15 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -__projects__ -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution -__solution_configurations__ - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution -__project_configurations__ - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tracer/tracer-vc9.sln b/tracer/tracer-vc9.sln deleted file mode 100644 index 2ec9432..0000000 --- a/tracer/tracer-vc9.sln +++ /dev/null @@ -1,15 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -__projects__ -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution -__solution_configurations__ - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution -__project_configurations__ - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal 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 |