From fc3fb39c90ab7fe5fccbe3f3bc0eb2645157bb96 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 13 Dec 2023 21:57:53 +0300 Subject: Switch to build2 --- common/relationship/basics/buildfile | 41 +++++++++++ common/relationship/basics/driver.cxx | 24 +++---- common/relationship/basics/makefile | 117 ------------------------------ common/relationship/basics/test.hxx | 30 -------- common/relationship/basics/test.std | 0 common/relationship/basics/testscript | 33 +++++++++ common/relationship/on-delete/buildfile | 43 +++++++++++ common/relationship/on-delete/driver.cxx | 16 +++-- common/relationship/on-delete/makefile | 119 ------------------------------- common/relationship/on-delete/test.std | 0 common/relationship/on-delete/testscript | 33 +++++++++ common/relationship/query/buildfile | 42 +++++++++++ common/relationship/query/driver.cxx | 16 ++--- common/relationship/query/makefile | 117 ------------------------------ common/relationship/query/test.hxx | 12 +--- common/relationship/query/test.std | 0 common/relationship/query/testscript | 33 +++++++++ 17 files changed, 249 insertions(+), 427 deletions(-) create mode 100644 common/relationship/basics/buildfile delete mode 100644 common/relationship/basics/makefile delete mode 100644 common/relationship/basics/test.std create mode 100644 common/relationship/basics/testscript create mode 100644 common/relationship/on-delete/buildfile delete mode 100644 common/relationship/on-delete/makefile delete mode 100644 common/relationship/on-delete/test.std create mode 100644 common/relationship/on-delete/testscript create mode 100644 common/relationship/query/buildfile delete mode 100644 common/relationship/query/makefile delete mode 100644 common/relationship/query/test.std create mode 100644 common/relationship/query/testscript (limited to 'common/relationship') diff --git a/common/relationship/basics/buildfile b/common/relationship/basics/buildfile new file mode 100644 index 0000000..d7bbb7e --- /dev/null +++ b/common/relationship/basics/buildfile @@ -0,0 +1,41 @@ +# file : common/relationship/basics/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +import libodb = libodb%lib{odb} + +libs = + +for db: $databases + import libs += libodb-$db%lib{odb-$db} + +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta} + +for db: $databases +{ + exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi + <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta} +} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix t_rel_basics_ \ + --generate-schema \ + --generate-query + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../../alias{database-client}: include = adhoc diff --git a/common/relationship/basics/driver.cxx b/common/relationship/basics/driver.cxx index 6eec1e2..e27c127 100644 --- a/common/relationship/basics/driver.cxx +++ b/common/relationship/basics/driver.cxx @@ -4,18 +4,20 @@ // Test object relationships. // -#include // std::auto_ptr -#include +#include // std::unique_ptr #include #include #include -#include +#include #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include + using namespace std; using namespace odb::core; @@ -24,19 +26,16 @@ main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); + unique_ptr db (create_database (argc, argv)); aggr a ("aggr"); a.o1 = new obj1 ("o1", "obj1"); a.o2.reset (new obj2 ("obj2")); -#ifdef HAVE_CXX11 a.v2.push_back (obj2_ptr (new obj2 ("v1 obj2 1"))); a.v2.push_back (0); a.v2.push_back (obj2_ptr (new obj2 ("v1 obj2 2"))); -#endif -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) a.o3.reset (new obj3 ("obj3")); a.c.num = 123; @@ -45,7 +44,6 @@ main (int argc, char* argv[]) a.cv.push_back (comp (234, obj3_ptr (new obj3 ("cv 0")))); a.cv.push_back (comp (235, obj3_ptr ())); a.cv.push_back (comp (236, obj3_ptr (new obj3 ("cv 2")))); -#endif a.v1.push_back (new obj1 ("v1 0", "v1 0")); a.v1.push_back (0); @@ -67,13 +65,10 @@ main (int argc, char* argv[]) db->persist (a.o1); db->persist (a.o2); -#ifdef HAVE_CXX11 for (obj2_vec::iterator i (a.v2.begin ()); i != a.v2.end (); ++i) if (*i) db->persist (*i); -#endif -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) db->persist (a.o3); db->persist (a.c.o3); @@ -81,7 +76,6 @@ main (int argc, char* argv[]) for (comp_vec::iterator i (a.cv.begin ()); i != a.cv.end (); ++i) if (i->o3) db->persist (i->o3); -#endif for (obj1_vec::iterator i (a.v1.begin ()); i != a.v1.end (); ++i) if (*i) @@ -103,7 +97,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr a1 (db->load (a.id)); + unique_ptr a1 (db->load (a.id)); t.commit (); assert (*a1 == a); @@ -130,9 +124,7 @@ main (int argc, char* argv[]) delete a.o1; a.o1 = 0; a.o2.reset (); -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) a.o3.reset (); -#endif { transaction t (db->begin ()); @@ -144,7 +136,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr a1 (db->load (a.id)); + unique_ptr a1 (db->load (a.id)); t.commit (); assert (*a1 == a); diff --git a/common/relationship/basics/makefile b/common/relationship/basics/makefile deleted file mode 100644 index 775d850..0000000 --- a/common/relationship/basics/makefile +++ /dev/null @@ -1,117 +0,0 @@ -# file : common/relationship/basics/makefile -# license : GNU GPL v2; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -cxx_tun := driver.cxx -odb_hdr := test.hxx -genf := $(call odb-gen,$(odb_hdr)) -gen := $(addprefix $(out_base)/,$(genf)) -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.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 - -# Import. -# -$(call import,\ - $(scf_root)/import/odb/stub.make,\ - odb: odb,odb-rules: odb_rules) - -# Build. -# -$(driver): $(cxx_obj) $(common.l) -$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -$(cxx_obj) $(cxx_od): $(common.l.cpp-options) - -$(gen): $(odb) -$(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --generate-schema --generate-query \ ---table-prefix t_rel_basics_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.l.cpp-options) - -ifneq ($(db_id),common) -$(gen): odb_options += --database $(db_id) -else -$(gen): odb_options += --multi-database dynamic -endif - -$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) - -# Alias for default target. -# -$(out_base)/: $(driver) - -# Dist -# -name := $(subst /,-,$(subst $(src_root)/common/,,$(src_base))) - -$(dist): sources := $(cxx_tun) -$(dist): headers := $(odb_hdr) -$(dist): data_dist := test.std -$(dist): export name := $(name) -$(dist): export extra_dist := $(data_dist) $(call vc8projs,$(name)) \ -$(call vc9projs,$(name)) $(call vc10projs,$(name)) $(call vc11projs,$(name)) \ -$(call vc12projs,$(name)) -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../../template/Makefile.am) - $(call meta-vc8projs,../../template/template,$(name)) - $(call meta-vc9projs,../../template/template,$(name)) - $(call meta-vc10projs,../../template/template,$(name)) - $(call meta-vc11projs,../../template/template,$(name)) - $(call meta-vc12projs,../../template/template,$(name)) - -# Test. -# -ifneq ($(db_id),common) -$(eval $(call test-rule)) -else -$(foreach d,$(databases),$(eval $(call test-rule,$d))) -endif - -# Clean. -# -$(clean): \ - $(driver).o.clean \ - $(addsuffix .cxx.clean,$(cxx_obj)) \ - $(addsuffix .cxx.clean,$(cxx_od)) \ - $(addsuffix .hxx.clean,$(filter %.cxx,$(gen))) - $(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/vc8proj.make) -$(call include,$(bld_root)/meta/vc9proj.make) -$(call include,$(bld_root)/meta/vc10proj.make) -$(call include,$(bld_root)/meta/vc11proj.make) -$(call include,$(bld_root)/meta/vc12proj.make) -$(call include,$(bld_root)/meta/automake.make) - -$(call include,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): odb_options += --std $(cxx_standard) -$(call include,$(odb_rules)) -endif - -$(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/common/relationship/basics/test.hxx b/common/relationship/basics/test.hxx index 9496581..8a2742e 100644 --- a/common/relationship/basics/test.hxx +++ b/common/relationship/basics/test.hxx @@ -4,8 +4,6 @@ #ifndef TEST_HXX #define TEST_HXX -#include // HAVE_CXX11, HAVE_TR1_MEMORY - #include #include #include @@ -14,10 +12,6 @@ #include -#if !defined(HAVE_CXX11) && defined(HAVE_TR1_MEMORY) -# include -#endif - // Raw pointer. // #pragma db object pointer(obj1*) @@ -121,11 +115,7 @@ operator== (const obj1_map& x, const obj1_map& y) // struct obj2; -#ifdef HAVE_CXX11 typedef std::unique_ptr obj2_ptr; -#else -typedef std::auto_ptr obj2_ptr; -#endif #pragma db object pointer(obj2_ptr) struct obj2 @@ -145,7 +135,6 @@ operator== (const obj2& x, const obj2& y) return x.id == y.id && x.str == y.str; } -#ifdef HAVE_CXX11 typedef std::vector obj2_vec; inline bool @@ -160,18 +149,12 @@ operator== (const obj2_vec& x, const obj2_vec& y) return true; } -#endif // shared_ptr // -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) struct obj3; -#ifdef HAVE_CXX11 typedef std::shared_ptr obj3_ptr; -#else -typedef std::tr1::shared_ptr obj3_ptr; -#endif #pragma db object pointer(obj3_ptr) struct obj3 @@ -211,7 +194,6 @@ operator== (const comp& x, const comp& y) } typedef std::vector comp_vec; -#endif // // @@ -241,19 +223,11 @@ struct aggr obj1* o1; obj2_ptr o2; // std::auto_ptr or std::unique_ptr -#ifdef HAVE_CXX11 obj2_vec v2; -#else - // Dummy containers to get the equivalent DROP TABLE statements. - // - std::vector v2; -#endif -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) obj3_ptr o3; comp c; comp_vec cv; -#endif obj1_vec v1; obj1_set s1; @@ -273,14 +247,10 @@ operator== (const aggr& x, const aggr& y) x.id == y.id && (x.o1 ? (y.o1 && *x.o1 == *y.o1) : !y.o1) && (x.o2.get () ? (y.o2.get () && *x.o2 == *y.o2) : !y.o2.get ()) && -#ifdef HAVE_CXX11 x.v2 == y.v2 && -#endif -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) (x.o3.get () ? (y.o3.get () && *x.o3 == *y.o3) : !y.o3.get ()) && x.c == y.c && x.cv == y.cv && -#endif x.v1 == y.v1 && x.s1 == y.s1 && x.m1 == y.m1 && diff --git a/common/relationship/basics/test.std b/common/relationship/basics/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/common/relationship/basics/testscript b/common/relationship/basics/testscript new file mode 100644 index 0000000..b498bfa --- /dev/null +++ b/common/relationship/basics/testscript @@ -0,0 +1,33 @@ +# file : common/relationship/basics/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../../database-options.testscript + +: mysql +: +if $mysql +{ + .include ../../../mysql.testscript + + $create_schema; + $* +} + +: sqlite +: +if $sqlite +{ + .include ../../../sqlite.testscript + + $* +} + +: pgsql +: +if $pgsql +{ + .include ../../../pgsql.testscript + + $create_schema; + $* +} diff --git a/common/relationship/on-delete/buildfile b/common/relationship/on-delete/buildfile new file mode 100644 index 0000000..965a2eb --- /dev/null +++ b/common/relationship/on-delete/buildfile @@ -0,0 +1,43 @@ +# file : common/relationship/on-delete/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +import libodb = libodb%lib{odb} + +libs = + +for db: $databases + import libs += libodb-$db%lib{odb-$db} + +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta} + +for db: $databases +{ + exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi + <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta} +} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix t_rel_on_d_ \ + --generate-schema \ + --fkeys-deferrable-mode mysql:not_deferrable \ + --fkeys-deferrable-mode mssql:not_deferrable + + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../../alias{database-client}: include = adhoc diff --git a/common/relationship/on-delete/driver.cxx b/common/relationship/on-delete/driver.cxx index b7cc37a..eec57cf 100644 --- a/common/relationship/on-delete/driver.cxx +++ b/common/relationship/on-delete/driver.cxx @@ -4,18 +4,20 @@ // Test ON DELETE functionality. // -#include // std::auto_ptr -#include +#include // std::unique_ptr #include #include #include -#include +#include #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include + using namespace std; using namespace odb::core; @@ -24,7 +26,7 @@ main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); + unique_ptr db (create_database (argc, argv)); object o; @@ -60,13 +62,13 @@ main (int argc, char* argv[]) transaction t (db->begin ()); assert (db->find (c.id) == 0); - auto_ptr pcc (db->load (cc.id)); + unique_ptr pcc (db->load (cc.id)); assert (pcc->p.empty ()); - auto_ptr pn (db->load (n.id)); + unique_ptr pn (db->load (n.id)); assert (pn->p == 0); - auto_ptr pnc (db->load (nc.id)); + unique_ptr pnc (db->load (nc.id)); assert (pnc->p.size () == 1 && pnc->p[0] == 0); t.commit (); diff --git a/common/relationship/on-delete/makefile b/common/relationship/on-delete/makefile deleted file mode 100644 index 88fcff0..0000000 --- a/common/relationship/on-delete/makefile +++ /dev/null @@ -1,119 +0,0 @@ -# file : common/relationship/on-delete/makefile -# license : GNU GPL v2; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -cxx_tun := driver.cxx -odb_hdr := test.hxx -genf := $(call odb-gen,$(odb_hdr)) -gen := $(addprefix $(out_base)/,$(genf)) -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.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 - -# Import. -# -$(call import,\ - $(scf_root)/import/odb/stub.make,\ - odb: odb,odb-rules: odb_rules) - -# Build. -# -$(driver): $(cxx_obj) $(common.l) -$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -$(cxx_obj) $(cxx_od): $(common.l.cpp-options) - -$(gen): $(odb) -$(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --generate-schema \ ---fkeys-deferrable-mode mysql:not_deferrable \ ---fkeys-deferrable-mode mssql:not_deferrable \ ---table-prefix t_rel_on_d_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.l.cpp-options) - -ifneq ($(db_id),common) -$(gen): odb_options += --database $(db_id) -else -$(gen): odb_options += --multi-database dynamic -endif - -$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) - -# Alias for default target. -# -$(out_base)/: $(driver) - -# Dist -# -name := $(subst /,-,$(subst $(src_root)/common/,,$(src_base))) - -$(dist): sources := $(cxx_tun) -$(dist): headers := $(odb_hdr) -$(dist): data_dist := test.std -$(dist): export name := $(name) -$(dist): export extra_dist := $(data_dist) $(call vc8projs,$(name)) \ -$(call vc9projs,$(name)) $(call vc10projs,$(name)) $(call vc11projs,$(name)) \ -$(call vc12projs,$(name)) -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../../template/Makefile.am) - $(call meta-vc8projs,../../template/template,$(name)) - $(call meta-vc9projs,../../template/template,$(name)) - $(call meta-vc10projs,../../template/template,$(name)) - $(call meta-vc11projs,../../template/template,$(name)) - $(call meta-vc12projs,../../template/template,$(name)) - -# Test. -# -ifneq ($(db_id),common) -$(eval $(call test-rule)) -else -$(foreach d,$(databases),$(eval $(call test-rule,$d))) -endif - -# Clean. -# -$(clean): \ - $(driver).o.clean \ - $(addsuffix .cxx.clean,$(cxx_obj)) \ - $(addsuffix .cxx.clean,$(cxx_od)) \ - $(addsuffix .hxx.clean,$(filter %.cxx,$(gen))) - $(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/vc8proj.make) -$(call include,$(bld_root)/meta/vc9proj.make) -$(call include,$(bld_root)/meta/vc10proj.make) -$(call include,$(bld_root)/meta/vc11proj.make) -$(call include,$(bld_root)/meta/vc12proj.make) -$(call include,$(bld_root)/meta/automake.make) - -$(call include,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): odb_options += --std $(cxx_standard) -$(call include,$(odb_rules)) -endif - -$(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/common/relationship/on-delete/test.std b/common/relationship/on-delete/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/common/relationship/on-delete/testscript b/common/relationship/on-delete/testscript new file mode 100644 index 0000000..8288ebc --- /dev/null +++ b/common/relationship/on-delete/testscript @@ -0,0 +1,33 @@ +# file : common/relationship/on-delete/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../../database-options.testscript + +: mysql +: +if $mysql +{ + .include ../../../mysql.testscript + + $create_schema; + $* +} + +: sqlite +: +if $sqlite +{ + .include ../../../sqlite.testscript + + $* +} + +: pgsql +: +if $pgsql +{ + .include ../../../pgsql.testscript + + $create_schema; + $* +} diff --git a/common/relationship/query/buildfile b/common/relationship/query/buildfile new file mode 100644 index 0000000..b70edc4 --- /dev/null +++ b/common/relationship/query/buildfile @@ -0,0 +1,42 @@ +# file : common/relationship/query/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +import libodb = libodb%lib{odb} + +libs = + +for db: $databases + import libs += libodb-$db%lib{odb-$db} + +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta} + +for db: $databases +{ + exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi + <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta} +} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix t_rel_query_ \ + --generate-schema \ + --generate-query \ + --generate-session + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../../alias{database-client}: include = adhoc diff --git a/common/relationship/query/driver.cxx b/common/relationship/query/driver.cxx index 1cee751..20d5370 100644 --- a/common/relationship/query/driver.cxx +++ b/common/relationship/query/driver.cxx @@ -4,20 +4,21 @@ // Test relationship queries. // -#include // std::auto_ptr -#include +#include // std::unique_ptr #include #include #include #include -#include // HAVE_CXX11, HAVE_TR1_MEMORY -#include +#include #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include + using namespace std; using namespace odb::core; @@ -26,9 +27,7 @@ main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); - -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) + unique_ptr db (create_database (argc, argv)); // // @@ -160,9 +159,6 @@ main (int argc, char* argv[]) t.commit (); } - -#endif // HAVE_CXX11 || HAVE_TR1_MEMORY - } catch (const odb::exception& e) { diff --git a/common/relationship/query/makefile b/common/relationship/query/makefile deleted file mode 100644 index 1632f1b..0000000 --- a/common/relationship/query/makefile +++ /dev/null @@ -1,117 +0,0 @@ -# file : common/relationship-query/query/makefile -# license : GNU GPL v2; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -cxx_tun := driver.cxx -odb_hdr := test.hxx -genf := $(call odb-gen,$(odb_hdr)) -gen := $(addprefix $(out_base)/,$(genf)) -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.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 - -# Import. -# -$(call import,\ - $(scf_root)/import/odb/stub.make,\ - odb: odb,odb-rules: odb_rules) - -# Build. -# -$(driver): $(cxx_obj) $(common.l) -$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -$(cxx_obj) $(cxx_od): $(common.l.cpp-options) - -$(gen): $(odb) -$(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --generate-schema --generate-query \ ---generate-session --table-prefix t_rel_query_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.l.cpp-options) - -ifneq ($(db_id),common) -$(gen): odb_options += --database $(db_id) -else -$(gen): odb_options += --multi-database dynamic -endif - -$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) - -# Alias for default target. -# -$(out_base)/: $(driver) - -# Dist -# -name := $(subst /,-,$(subst $(src_root)/common/,,$(src_base))) - -$(dist): sources := $(cxx_tun) -$(dist): headers := $(odb_hdr) -$(dist): data_dist := test.std -$(dist): export name := $(name) -$(dist): export extra_dist := $(data_dist) $(call vc8projs,$(name)) \ -$(call vc9projs,$(name)) $(call vc10projs,$(name)) $(call vc11projs,$(name)) \ -$(call vc12projs,$(name)) -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../../template/Makefile.am) - $(call meta-vc8projs,../../template/template,$(name)) - $(call meta-vc9projs,../../template/template,$(name)) - $(call meta-vc10projs,../../template/template,$(name)) - $(call meta-vc11projs,../../template/template,$(name)) - $(call meta-vc12projs,../../template/template,$(name)) - -# Test. -# -ifneq ($(db_id),common) -$(eval $(call test-rule)) -else -$(foreach d,$(databases),$(eval $(call test-rule,$d))) -endif - -# Clean. -# -$(clean): \ - $(driver).o.clean \ - $(addsuffix .cxx.clean,$(cxx_obj)) \ - $(addsuffix .cxx.clean,$(cxx_od)) \ - $(addsuffix .hxx.clean,$(filter %.cxx,$(gen))) - $(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/vc8proj.make) -$(call include,$(bld_root)/meta/vc9proj.make) -$(call include,$(bld_root)/meta/vc10proj.make) -$(call include,$(bld_root)/meta/vc11proj.make) -$(call include,$(bld_root)/meta/vc12proj.make) -$(call include,$(bld_root)/meta/automake.make) - -$(call include,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): odb_options += --std $(cxx_standard) -$(call include,$(odb_rules)) -endif - -$(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/common/relationship/query/test.hxx b/common/relationship/query/test.hxx index b25e27e..c6e2d6d 100644 --- a/common/relationship/query/test.hxx +++ b/common/relationship/query/test.hxx @@ -4,21 +4,12 @@ #ifndef TEST_HXX #define TEST_HXX -#include // HAVE_CXX11, HAVE_TR1_MEMORY - -#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) - #include +#include #include -#ifdef HAVE_CXX11 -# include using std::shared_ptr; -#else -# include -using std::tr1::shared_ptr; -#endif struct country; @@ -146,5 +137,4 @@ struct country std::string name; }; -#endif // HAVE_CXX11 || HAVE_TR1_MEMORY #endif // TEST_HXX diff --git a/common/relationship/query/test.std b/common/relationship/query/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/common/relationship/query/testscript b/common/relationship/query/testscript new file mode 100644 index 0000000..d5ad419 --- /dev/null +++ b/common/relationship/query/testscript @@ -0,0 +1,33 @@ +# file : common/relationship/query/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../../database-options.testscript + +: mysql +: +if $mysql +{ + .include ../../../mysql.testscript + + $create_schema; + $* +} + +: sqlite +: +if $sqlite +{ + .include ../../../sqlite.testscript + + $* +} + +: pgsql +: +if $pgsql +{ + .include ../../../pgsql.testscript + + $create_schema; + $* +} -- cgit v1.1