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 --- pgsql/Makefile.am | 5 - pgsql/buildfile | 6 + pgsql/bulk/buildfile | 40 +++ pgsql/bulk/driver.cxx | 39 ++- pgsql/bulk/makefile | 107 -------- pgsql/bulk/test.std | 0 pgsql/bulk/testscript | 18 ++ pgsql/custom/buildfile | 37 +++ pgsql/custom/driver.cxx | 14 +- pgsql/custom/makefile | 110 -------- pgsql/custom/test.std | 0 pgsql/custom/testscript | 11 + pgsql/database/buildfile | 11 + pgsql/database/driver.cxx | 3 + pgsql/database/makefile | 79 ------ pgsql/database/test.std | 0 pgsql/database/testscript | 6 + pgsql/index/buildfile | 34 +++ pgsql/index/driver.cxx | 10 +- pgsql/index/makefile | 107 -------- pgsql/index/test.std | 0 pgsql/index/testscript | 11 + pgsql/makefile | 41 --- pgsql/native/buildfile | 16 ++ pgsql/native/driver.cxx | 10 +- pgsql/native/makefile | 79 ------ pgsql/native/test.std | 0 pgsql/native/testscript | 9 + pgsql/savepoint/driver.cxx | 58 ----- pgsql/savepoint/makefile | 107 -------- pgsql/savepoint/test.hxx | 27 -- pgsql/savepoint/test.std | 0 pgsql/template/Makefile.am | 34 --- pgsql/template/driver.cxx | 40 --- pgsql/template/makefile | 107 -------- pgsql/template/template-vc10.vcxproj | 180 ------------- pgsql/template/template-vc10.vcxproj.filters | 25 -- pgsql/template/template-vc11.vcxproj | 184 -------------- pgsql/template/template-vc11.vcxproj.filters | 25 -- pgsql/template/template-vc12.vcxproj | 188 -------------- pgsql/template/template-vc12.vcxproj.filters | 25 -- pgsql/template/template-vc8.vcproj | 354 -------------------------- pgsql/template/template-vc9.vcproj | 361 --------------------------- pgsql/template/test.hxx | 25 -- pgsql/template/test.std | 0 pgsql/test.bat | 68 ----- pgsql/truncation/buildfile | 35 +++ pgsql/truncation/driver.cxx | 16 +- pgsql/truncation/makefile | 107 -------- pgsql/truncation/test.std | 0 pgsql/truncation/testscript | 11 + pgsql/types/buildfile | 36 +++ pgsql/types/driver.cxx | 18 +- pgsql/types/makefile | 109 -------- pgsql/types/test.hxx | 6 +- pgsql/types/test.std | 0 pgsql/types/testscript | 11 + 57 files changed, 367 insertions(+), 2593 deletions(-) delete mode 100644 pgsql/Makefile.am create mode 100644 pgsql/buildfile create mode 100644 pgsql/bulk/buildfile delete mode 100644 pgsql/bulk/makefile delete mode 100644 pgsql/bulk/test.std create mode 100644 pgsql/bulk/testscript create mode 100644 pgsql/custom/buildfile delete mode 100644 pgsql/custom/makefile delete mode 100644 pgsql/custom/test.std create mode 100644 pgsql/custom/testscript create mode 100644 pgsql/database/buildfile delete mode 100644 pgsql/database/makefile delete mode 100644 pgsql/database/test.std create mode 100644 pgsql/database/testscript create mode 100644 pgsql/index/buildfile delete mode 100644 pgsql/index/makefile delete mode 100644 pgsql/index/test.std create mode 100644 pgsql/index/testscript delete mode 100644 pgsql/makefile create mode 100644 pgsql/native/buildfile delete mode 100644 pgsql/native/makefile delete mode 100644 pgsql/native/test.std create mode 100644 pgsql/native/testscript delete mode 100644 pgsql/savepoint/driver.cxx delete mode 100644 pgsql/savepoint/makefile delete mode 100644 pgsql/savepoint/test.hxx delete mode 100644 pgsql/savepoint/test.std delete mode 100644 pgsql/template/Makefile.am delete mode 100644 pgsql/template/driver.cxx delete mode 100644 pgsql/template/makefile delete mode 100644 pgsql/template/template-vc10.vcxproj delete mode 100644 pgsql/template/template-vc10.vcxproj.filters delete mode 100644 pgsql/template/template-vc11.vcxproj delete mode 100644 pgsql/template/template-vc11.vcxproj.filters delete mode 100644 pgsql/template/template-vc12.vcxproj delete mode 100644 pgsql/template/template-vc12.vcxproj.filters delete mode 100644 pgsql/template/template-vc8.vcproj delete mode 100644 pgsql/template/template-vc9.vcproj delete mode 100644 pgsql/template/test.hxx delete mode 100644 pgsql/template/test.std delete mode 100644 pgsql/test.bat create mode 100644 pgsql/truncation/buildfile delete mode 100644 pgsql/truncation/makefile delete mode 100644 pgsql/truncation/test.std create mode 100644 pgsql/truncation/testscript create mode 100644 pgsql/types/buildfile delete mode 100644 pgsql/types/makefile delete mode 100644 pgsql/types/test.std create mode 100644 pgsql/types/testscript (limited to 'pgsql') diff --git a/pgsql/Makefile.am b/pgsql/Makefile.am deleted file mode 100644 index fcf14e8..0000000 --- a/pgsql/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# file : pgsql/Makefile.am -# license : GNU GPL v2; see accompanying LICENSE file - -SUBDIRS = __path__(dirs) -EXTRA_DIST = __file__(extra_dist) diff --git a/pgsql/buildfile b/pgsql/buildfile new file mode 100644 index 0000000..c6385c0 --- /dev/null +++ b/pgsql/buildfile @@ -0,0 +1,6 @@ +# file : pgsql/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +./: {*/ -bulk/} + +./: bulk/: include = ($pgsql && !$multi && $pgsql_bulk) diff --git a/pgsql/bulk/buildfile b/pgsql/bulk/buildfile new file mode 100644 index 0000000..6984edb --- /dev/null +++ b/pgsql/bulk/buildfile @@ -0,0 +1,40 @@ +# file : pgsql/bulk/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') +{ + assert ($pgsql && !$multi) \ + "pgsql should be configured via config.odb_tests.database variable as a single database" + + assert ($pgsql_bulk) "bulk operations are disabled for pgsql" +} + +import libodb = libodb%lib{odb} + +import libs = libpq%lib{pq} +import libs += libodb-pgsql%lib{odb-pgsql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-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} + +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 pgsql_bulk_ \ + --generate-schema \ + --generate-query + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/bulk/driver.cxx b/pgsql/bulk/driver.cxx index fd629b8..ba25542 100644 --- a/pgsql/bulk/driver.cxx +++ b/pgsql/bulk/driver.cxx @@ -1,4 +1,4 @@ -// file : pgsql/savepoint/driver.cxx +// file : pgsql/bulk/driver.cxx // license : GNU GPL v2; see accompanying LICENSE file // Test transaction savepoints. @@ -10,7 +10,6 @@ #include #include #include -#include #include // Note: hack. @@ -18,6 +17,9 @@ #include #define htonll(x) ((((long long)htonl(x)) << 32) + htonl((x) >> 32)) +#undef NDEBUG +#include + static const size_t columns = 3; struct data @@ -255,20 +257,22 @@ test (PGconn* conn) } } -#include // std::auto_ptr -#include -#include - #include +#include // std::unique_ptr +#include +#include #include #include -#include +#include #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include + using namespace std; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -276,9 +280,26 @@ using namespace pgsql; int main (int argc, char* argv[]) { + bool fail_already_persistent (false); + + for (int i (1); i != argc; ++i) + { + if (strcmp (argv[i], "--fail-already-persistent") == 0) + { + fail_already_persistent = true; + + for (; i != argc - 1; ++i) + argv[i] = argv[i + 1]; + + --argc; + + break; + } + } + try { - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); connection_ptr cn (db->connection ()); @@ -297,7 +318,7 @@ main (int argc, char* argv[]) { os.push_back (object {i, i, string (i, 'x')}); - if (i == n / 2) + if (fail_already_persistent && i == n / 2) os.push_back (object {i, i, to_string (i)}); } diff --git a/pgsql/bulk/makefile b/pgsql/bulk/makefile deleted file mode 100644 index 12f8dbb..0000000 --- a/pgsql/bulk/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : pgsql/savepoint/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 += --database pgsql --generate-schema \ ---generate-query --table-prefix pgsql_bulk_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/bulk/test.std b/pgsql/bulk/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/bulk/testscript b/pgsql/bulk/testscript new file mode 100644 index 0000000..60b7d92 --- /dev/null +++ b/pgsql/bulk/testscript @@ -0,0 +1,18 @@ +# file : pgsql/custom/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + ++$create_schema + +: basics +: +{ + $*; + + $* --fail-already-persistent 2>>EOE != 0 + multiple exceptions, 252 elements attempted, 1 failed, fatal: + [251] object already persistent + EOE +} diff --git a/pgsql/custom/buildfile b/pgsql/custom/buildfile new file mode 100644 index 0000000..a5c6717 --- /dev/null +++ b/pgsql/custom/buildfile @@ -0,0 +1,37 @@ +# file : pgsql/custom/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libodb = libodb%lib{odb} + +import libs = libodb-pgsql%lib{odb-pgsql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-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} + +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 pgsql_custom_ \ + --generate-schema \ + --default-database common \ + --generate-query \ + --hxx-prologue '#include "traits.hxx"' \ + --hxx-prologue '#include "query.hxx"' + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/custom/driver.cxx b/pgsql/custom/driver.cxx index bc52674..91ff0ce 100644 --- a/pgsql/custom/driver.cxx +++ b/pgsql/custom/driver.cxx @@ -4,18 +4,20 @@ // Test custom database type mapping in PostgreSQL. // -#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; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -25,7 +27,7 @@ main (int argc, char* argv[]) { try { - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); object o (1); o.p = point (1.1111, 2222222222.2); @@ -53,7 +55,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr o1 (db->load (1)); + unique_ptr o1 (db->load (1)); t.commit (); assert (o == *o1); @@ -109,7 +111,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr o1 (db->load (1)); + unique_ptr o1 (db->load (1)); t.commit (); assert (o == *o1); diff --git a/pgsql/custom/makefile b/pgsql/custom/makefile deleted file mode 100644 index 18f11e6..0000000 --- a/pgsql/custom/makefile +++ /dev/null @@ -1,110 +0,0 @@ -# file : pgsql/custom/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 += --database pgsql --default-database \ -common --generate-schema --generate-query --hxx-prologue \ -'\#include "traits.hxx"' --hxx-prologue '\#include "query.hxx"' \ ---table-prefix pgsql_custom_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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): export extra_headers := traits.hxx query.hxx -$(dist): data_dist := test.std -$(dist): export name := $(subst /,-,$(subst $(src_root)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(extra_headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/custom/test.std b/pgsql/custom/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/custom/testscript b/pgsql/custom/testscript new file mode 100644 index 0000000..8e1448b --- /dev/null +++ b/pgsql/custom/testscript @@ -0,0 +1,11 @@ +# file : pgsql/custom/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + ++$create_schema + +: basics +: +$* diff --git a/pgsql/database/buildfile b/pgsql/database/buildfile new file mode 100644 index 0000000..6977ea6 --- /dev/null +++ b/pgsql/database/buildfile @@ -0,0 +1,11 @@ +# file : pgsql/database/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libs = libodb-pgsql%lib{odb-pgsql} + +exe{driver}: {hxx cxx}{*} $libs testscript + +cxx.poptions =+ "-I$out_base" "-I$src_base" diff --git a/pgsql/database/driver.cxx b/pgsql/database/driver.cxx index 5673caa..56bde0a 100644 --- a/pgsql/database/driver.cxx +++ b/pgsql/database/driver.cxx @@ -6,6 +6,9 @@ #include +#undef NDEBUG +#include + namespace pgsql = odb::pgsql; using namespace pgsql; diff --git a/pgsql/database/makefile b/pgsql/database/makefile deleted file mode 100644 index 2948467..0000000 --- a/pgsql/database/makefile +++ /dev/null @@ -1,79 +0,0 @@ -# file : pgsql/database/makefile -# 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) - -common.l := $(out_root)/libcommon/common/common.l -common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options - -# 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) - -$(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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-schemaless-rule)) - -# 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/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/cxx-d.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/o-e.make) diff --git a/pgsql/database/test.std b/pgsql/database/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/database/testscript b/pgsql/database/testscript new file mode 100644 index 0000000..f57a8e1 --- /dev/null +++ b/pgsql/database/testscript @@ -0,0 +1,6 @@ +# file : pgsql/database/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +: basics +: +$* diff --git a/pgsql/index/buildfile b/pgsql/index/buildfile new file mode 100644 index 0000000..a84ed9a --- /dev/null +++ b/pgsql/index/buildfile @@ -0,0 +1,34 @@ +# file : pgsql/index/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libodb = libodb%lib{odb} + +import libs = libodb-pgsql%lib{odb-pgsql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-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} + +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 pgsql_index_ \ + --generate-schema \ + --default-database common + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/index/driver.cxx b/pgsql/index/driver.cxx index eb7de4b..dc4c11e 100644 --- a/pgsql/index/driver.cxx +++ b/pgsql/index/driver.cxx @@ -4,18 +4,20 @@ // Test PostgreSQL index creation. See also the common test. // -#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; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -27,7 +29,7 @@ main (int argc, char* argv[]) { // This is just a schema creation test. // - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); { transaction t (db->begin ()); diff --git a/pgsql/index/makefile b/pgsql/index/makefile deleted file mode 100644 index 9db50ce..0000000 --- a/pgsql/index/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : pgsql/index/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 += --database pgsql --default-database \ -common --generate-schema --table-prefix pgsql_index_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/index/test.std b/pgsql/index/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/index/testscript b/pgsql/index/testscript new file mode 100644 index 0000000..671a8c3 --- /dev/null +++ b/pgsql/index/testscript @@ -0,0 +1,11 @@ +# file : pgsql/index/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + ++$create_schema + +: basics +: +$* diff --git a/pgsql/makefile b/pgsql/makefile deleted file mode 100644 index 91520b2..0000000 --- a/pgsql/makefile +++ /dev/null @@ -1,41 +0,0 @@ -# file : pgsql/makefile -# license : GNU GPL; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make - -tests := \ -template \ -custom \ -database \ -index \ -native \ -truncation \ -types - -$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) - -$(dist): name := pgsql -$(dist): export dirs := $(tests) -$(dist): export extra_dist := $(name)-vc8.sln $(name)-vc9.sln \ -$(name)-vc10.sln $(name)-vc11.sln $(name)-vc12.sln test.bat -$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(tests))) - $(call meta-automake) - $(call meta-vc8sln1,$(name)) - $(call meta-vc9sln1,$(name)) - $(call meta-vc10sln1,$(name)) - $(call meta-vc11sln1,$(name)) - $(call meta-vc12sln1,$(name)) - $(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/vc8sln.make) -$(call include,$(bld_root)/meta/vc9sln.make) -$(call include,$(bld_root)/meta/vc10sln.make) -$(call include,$(bld_root)/meta/vc11sln.make) -$(call include,$(bld_root)/meta/vc12sln.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/pgsql/native/buildfile b/pgsql/native/buildfile new file mode 100644 index 0000000..ec4c80c --- /dev/null +++ b/pgsql/native/buildfile @@ -0,0 +1,16 @@ +# file : pgsql/native/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libs = libodb-pgsql%lib{odb-pgsql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{*} $libs testscript + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/native/driver.cxx b/pgsql/native/driver.cxx index 2cea8dd..843db41 100644 --- a/pgsql/native/driver.cxx +++ b/pgsql/native/driver.cxx @@ -4,14 +4,16 @@ // Test PostgreSQL native SQL execution. // -#include // std::auto_ptr -#include +#include // std::unique_ptr #include #include #include -#include +#include + +#undef NDEBUG +#include using namespace std; namespace pgsql = odb::pgsql; @@ -22,7 +24,7 @@ main (int argc, char* argv[]) { try { - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); // Create the database schema. // diff --git a/pgsql/native/makefile b/pgsql/native/makefile deleted file mode 100644 index f82e0fc..0000000 --- a/pgsql/native/makefile +++ /dev/null @@ -1,79 +0,0 @@ -# file : pgsql/native/makefile -# 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) - -common.l := $(out_root)/libcommon/common/common.l -common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options - -# 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) - -$(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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-schemaless-rule)) - -# 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/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/cxx-d.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/o-e.make) diff --git a/pgsql/native/test.std b/pgsql/native/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/native/testscript b/pgsql/native/testscript new file mode 100644 index 0000000..4fd9d2c --- /dev/null +++ b/pgsql/native/testscript @@ -0,0 +1,9 @@ +# file : pgsql/custom/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + +: basics +: +$* diff --git a/pgsql/savepoint/driver.cxx b/pgsql/savepoint/driver.cxx deleted file mode 100644 index 7ac3df0..0000000 --- a/pgsql/savepoint/driver.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// file : pgsql/savepoint/driver.cxx -// license : GNU GPL v2; see accompanying LICENSE file - -// Test transaction savepoints. -// - -#include // std::auto_ptr -#include -#include - -#include -#include - -#include - -#include "test.hxx" -#include "test-odb.hxx" - -using namespace std; -namespace pgsql = odb::pgsql; -using namespace pgsql; - -int -main (int argc, char* argv[]) -{ - try - { - auto_ptr db (create_specific_database (argc, argv)); - - { - object o1 (1); - object o2 (2); - - transaction t (db->begin ()); - db->persist (o1); - - /* - try - { - db->persist (o1); - assert (false); - } - catch (const odb::object_already_persistent&) - { - } - */ - - //db->persist (o2); - - t.commit (); - } - } - catch (const odb::exception& e) - { - cerr << e.what () << endl; - return 1; - } -} diff --git a/pgsql/savepoint/makefile b/pgsql/savepoint/makefile deleted file mode 100644 index f2046f8..0000000 --- a/pgsql/savepoint/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : pgsql/savepoint/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 += --database pgsql --default-database \ -common --generate-schema --generate-query --table-prefix pgsql_savepoint_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/savepoint/test.hxx b/pgsql/savepoint/test.hxx deleted file mode 100644 index 7e01992..0000000 --- a/pgsql/savepoint/test.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// file : pgsql/savepoint/test.hxx -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST_HXX -#define TEST_HXX - -#include - -#include - -#pragma db object bulk(100) -struct object -{ - object (unsigned long id) - : id_ (id) - { - } - - object () - { - } - - #pragma db id - unsigned long id_; -}; - -#endif // TEST_HXX diff --git a/pgsql/savepoint/test.std b/pgsql/savepoint/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/template/Makefile.am b/pgsql/template/Makefile.am deleted file mode 100644 index a9c40d3..0000000 --- a/pgsql/template/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# file : pgsql/template/Makefile.am -# 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) -LDADD = $(top_builddir)/libcommon/common/libcommon.la -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; - -__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@ - -if HAVE_CXX11 -ODBFLAGS += --std c++11 -endif - -test-odb.hxx: test.hxx - $(ODB) $(AM_CPPFLAGS) $(ODBCPPFLAGS) $(CPPFLAGS) $(ODBFLAGS) __value__(odb_options) $< -) diff --git a/pgsql/template/driver.cxx b/pgsql/template/driver.cxx deleted file mode 100644 index 98ce17a..0000000 --- a/pgsql/template/driver.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// file : pgsql/template/driver.cxx -// license : GNU GPL v2; see accompanying LICENSE file - -// PLACE TEST DESCRIPTION HERE -// - -#include // std::auto_ptr -#include -#include - -#include -#include - -#include - -#include "test.hxx" -#include "test-odb.hxx" - -using namespace std; -namespace pgsql = odb::pgsql; -using namespace pgsql; - -int -main (int argc, char* argv[]) -{ - try - { - auto_ptr db (create_specific_database (argc, argv)); - - { - transaction t (db->begin ()); - t.commit (); - } - } - catch (const odb::exception& e) - { - cerr << e.what () << endl; - return 1; - } -} diff --git a/pgsql/template/makefile b/pgsql/template/makefile deleted file mode 100644 index 70b23c3..0000000 --- a/pgsql/template/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : pgsql/template/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 += --database pgsql --default-database \ -common --generate-schema --table-prefix pgsql_template_ #@@ CHANGE THIS -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/template/template-vc10.vcxproj b/pgsql/template/template-vc10.vcxproj deleted file mode 100644 index 4bf096a..0000000 --- a/pgsql/template/template-vc10.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {__uuid__()} - Win32Proj - __value__(name) - - - - Application - true - Unicode - - - Application - true - Unicode - - - Application - false - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - - - - true - $(Configuration)\ - driver - - - true - $(Platform)\$(Configuration)\ - driver - - - false - $(Configuration)\ - driver - - - false - $(Platform)\$(Configuration)\ - driver - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-d.lib;%(AdditionalDependencies) - Console - true - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-d.lib;%(AdditionalDependencies) - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib\common.lib;odb-pgsql.lib;odb.lib;%(AdditionalDependencies) - Console - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb.lib;%(AdditionalDependencies) - Console - true - true - true - - -__ifelse__(__value__(odb_options),,, -m4_dnl - -__custom_build_entry__( -test.hxx, -odb test.hxx, -odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 -I$(SolutionDir)\..\libcommon)) test.hxx, -test-odb.hxx;test-odb.ixx;test-odb.cxx) - ) - -__ifelse__(__value__(odb_options),,, -__header_entry__(test-odb.hxx) -__header_entry__(test-odb.ixx)) -__header_entries__(extra_headers) - - -__source_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - - - - - diff --git a/pgsql/template/template-vc10.vcxproj.filters b/pgsql/template/template-vc10.vcxproj.filters deleted file mode 100644 index 8ac18a3..0000000 --- a/pgsql/template/template-vc10.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {__uuid__()} - cxx - - - {__uuid__()} - h;hxx;ixx;txx - - - -__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) - - -__source_filter_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx)) -__source_filter_entries__(extra_sources) - - \ No newline at end of file diff --git a/pgsql/template/template-vc11.vcxproj b/pgsql/template/template-vc11.vcxproj deleted file mode 100644 index 9e7c682..0000000 --- a/pgsql/template/template-vc11.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {__uuid__()} - Win32Proj - __value__(name) - - - - Application - true - v110 - Unicode - - - Application - true - v110 - Unicode - - - Application - false - v110 - true - Unicode - - - Application - false - v110 - true - Unicode - - - - - - - - - - - - - - - - - - - true - $(Configuration)\ - driver - - - true - $(Platform)\$(Configuration)\ - driver - - - false - $(Configuration)\ - driver - - - false - $(Platform)\$(Configuration)\ - driver - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-d.lib;%(AdditionalDependencies) - Console - true - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-d.lib;%(AdditionalDependencies) - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib\common.lib;odb-pgsql.lib;odb.lib;%(AdditionalDependencies) - Console - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - - - $(SolutionDir)\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb.lib;%(AdditionalDependencies) - Console - true - true - true - - -__ifelse__(__value__(odb_options),,, -m4_dnl - -__custom_build_entry__( -test.hxx, -odb test.hxx, -odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\libcommon)) test.hxx, -test-odb.hxx;test-odb.ixx;test-odb.cxx) - ) - -__ifelse__(__value__(odb_options),,, -__header_entry__(test-odb.hxx) -__header_entry__(test-odb.ixx)) -__header_entries__(extra_headers) - - -__source_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - - - - - diff --git a/pgsql/template/template-vc11.vcxproj.filters b/pgsql/template/template-vc11.vcxproj.filters deleted file mode 100644 index 8ac18a3..0000000 --- a/pgsql/template/template-vc11.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {__uuid__()} - cxx - - - {__uuid__()} - h;hxx;ixx;txx - - - -__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) - - -__source_filter_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx)) -__source_filter_entries__(extra_sources) - - \ No newline at end of file diff --git a/pgsql/template/template-vc12.vcxproj b/pgsql/template/template-vc12.vcxproj deleted file mode 100644 index 415dad4..0000000 --- a/pgsql/template/template-vc12.vcxproj +++ /dev/null @@ -1,188 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {__uuid__()} - Win32Proj - __value__(name) - - - - Application - true - v120 - Unicode - - - Application - true - v120 - Unicode - - - Application - false - v120 - true - Unicode - - - Application - false - v120 - true - Unicode - - - - - - - - - - - - - - - - - - - true - $(Configuration)\ - driver - - - true - $(Platform)\$(Configuration)\ - driver - - - false - $(Configuration)\ - driver - - - false - $(Platform)\$(Configuration)\ - driver - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - true - - - $(SolutionDir)\..\libcommon\lib\common-d.lib;odb-pgsql-d.lib;odb-d.lib;%(AdditionalDependencies) - Console - true - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - true - - - $(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-pgsql-d.lib;odb-d.lib;%(AdditionalDependencies) - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - true - - - $(SolutionDir)\..\libcommon\lib\common.lib;odb-pgsql.lib;odb.lib;%(AdditionalDependencies) - Console - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) - $(SolutionDir)\..\libcommon - 4068;4355;4800;4290;%(DisableSpecificWarnings) - true - - - $(SolutionDir)\..\libcommon\lib64\common.lib;odb-pgsql.lib;odb.lib;%(AdditionalDependencies) - Console - true - true - true - - -__ifelse__(__value__(odb_options),,, -m4_dnl - -__custom_build_entry__( -test.hxx, -odb test.hxx, -odb.exe --std c++11 __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 -I$(SolutionDir)\..\libcommon)) test.hxx, -test-odb.hxx;test-odb.ixx;test-odb.cxx) - ) - -__ifelse__(__value__(odb_options),,, -__header_entry__(test-odb.hxx) -__header_entry__(test-odb.ixx)) -__header_entries__(extra_headers) - - -__source_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - - - - - diff --git a/pgsql/template/template-vc12.vcxproj.filters b/pgsql/template/template-vc12.vcxproj.filters deleted file mode 100644 index 8ac18a3..0000000 --- a/pgsql/template/template-vc12.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {__uuid__()} - cxx - - - {__uuid__()} - h;hxx;ixx;txx - - - -__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) - - -__source_filter_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx)) -__source_filter_entries__(extra_sources) - - \ No newline at end of file diff --git a/pgsql/template/template-vc8.vcproj b/pgsql/template/template-vc8.vcproj deleted file mode 100644 index 3b2bbc3..0000000 --- a/pgsql/template/template-vc8.vcproj +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__source_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - - -__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 -DODB_MSC_VER=1400 -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) - - - - - diff --git a/pgsql/template/template-vc9.vcproj b/pgsql/template/template-vc9.vcproj deleted file mode 100644 index 3a75a38..0000000 --- a/pgsql/template/template-vc9.vcproj +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__source_entry__(driver.cxx) -__ifelse__(__value__(odb_options),,,__source_entry__(test-odb.cxx)) -__source_entries__(extra_sources) - - -__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 -DODB_MSC_VER=1500 -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) - - - - - diff --git a/pgsql/template/test.hxx b/pgsql/template/test.hxx deleted file mode 100644 index 01670b1..0000000 --- a/pgsql/template/test.hxx +++ /dev/null @@ -1,25 +0,0 @@ -// file : pgsql/template/test.hxx -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST_HXX -#define TEST_HXX - -#include - -#pragma db object -struct object -{ - object (unsigned long id) - : id_ (id) - { - } - - object () - { - } - - #pragma db id - unsigned long id_; -}; - -#endif // TEST_HXX diff --git a/pgsql/template/test.std b/pgsql/template/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/test.bat b/pgsql/test.bat deleted file mode 100644 index 6b4dd61..0000000 --- a/pgsql/test.bat +++ /dev/null @@ -1,68 +0,0 @@ -@echo off -rem file : pgsql/test.bat -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 pgsql %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/pgsql/truncation/buildfile b/pgsql/truncation/buildfile new file mode 100644 index 0000000..2f2f3a2 --- /dev/null +++ b/pgsql/truncation/buildfile @@ -0,0 +1,35 @@ +# file : pgsql/truncation/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libodb = libodb%lib{odb} + +import libs = libodb-pgsql%lib{odb-pgsql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-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} + +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 pgsql_truncation_ \ + --generate-schema \ + --default-database common \ + --generate-query + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/truncation/driver.cxx b/pgsql/truncation/driver.cxx index 63135d4..337a26e 100644 --- a/pgsql/truncation/driver.cxx +++ b/pgsql/truncation/driver.cxx @@ -4,18 +4,20 @@ // Test insufficient buffer/truncation handling. // -#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; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -33,7 +35,7 @@ main (int argc, char* argv[]) // Test basic operations. // { - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); // Run persist/load so that the initial bindings are established // (version == 0). @@ -71,7 +73,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr o (db->load (3)); + unique_ptr o (db->load (3)); assert (o->str_ == long_str); t.commit (); } @@ -89,7 +91,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr o (db->load (3)); + unique_ptr o (db->load (3)); assert (o->str_ == longer_str); t.commit (); } @@ -101,7 +103,7 @@ main (int argc, char* argv[]) typedef pgsql::query query; typedef odb::result result; - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); // Run persist/query so that the initial bindings are established // (version == 0). diff --git a/pgsql/truncation/makefile b/pgsql/truncation/makefile deleted file mode 100644 index 9519291..0000000 --- a/pgsql/truncation/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : pgsql/truncation/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 += --database pgsql --default-database \ -common --generate-schema --generate-query --table-prefix pgsql_truncation_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/truncation/test.std b/pgsql/truncation/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/truncation/testscript b/pgsql/truncation/testscript new file mode 100644 index 0000000..c57b723 --- /dev/null +++ b/pgsql/truncation/testscript @@ -0,0 +1,11 @@ +# file : pgsql/truncation/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + ++$create_schema + +: basics +: +$* diff --git a/pgsql/types/buildfile b/pgsql/types/buildfile new file mode 100644 index 0000000..64f0c02 --- /dev/null +++ b/pgsql/types/buildfile @@ -0,0 +1,36 @@ +# file : pgsql/types/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libodb = libodb%lib{odb} +import libcommon = lib{common} +import libs = libodb-pgsql%lib{odb-pgsql} + +exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript + +# Introduce the metadata library target to make sure the libodb and libcommon +# libraries are resolved for the odb_compile ad hoc rule (see build/root.build +# for details). +# +libue{test-meta}: $libodb $libcommon + +<{hxx ixx cxx}{test-odb}>: 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 pgsql_types_ \ + --generate-schema \ + --default-database common \ + --generate-query \ + --cxx-prologue '#include "traits.hxx"' + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/types/driver.cxx b/pgsql/types/driver.cxx index c2b54be..710f601 100644 --- a/pgsql/types/driver.cxx +++ b/pgsql/types/driver.cxx @@ -4,18 +4,20 @@ // Test PostgreSQL type conversion. // -#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; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -25,7 +27,7 @@ main (int argc, char* argv[]) { try { - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); object o (1); @@ -79,7 +81,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr o1 (db->load (1)); + unique_ptr o1 (db->load (1)); t.commit (); assert (o == *o1); @@ -144,9 +146,9 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr p1 (db->load (1)); - auto_ptr p2 (db->load (2)); - auto_ptr p3 (db->load (3)); + unique_ptr p1 (db->load (1)); + unique_ptr p2 (db->load (2)); + unique_ptr p3 (db->load (3)); t.commit (); assert (o1 == *p1); diff --git a/pgsql/types/makefile b/pgsql/types/makefile deleted file mode 100644 index c3321b7..0000000 --- a/pgsql/types/makefile +++ /dev/null @@ -1,109 +0,0 @@ -# file : pgsql/types/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 += --database pgsql --default-database \ -common --generate-schema --generate-query --cxx-prologue \ -'\#include "traits.hxx"' --table-prefix pgsql_types_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.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): export extra_headers := traits.hxx -$(dist): data_dist := test.std -$(dist): export name := $(subst /,-,$(subst $(src_root)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(extra_headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# 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/pgsql/types/test.hxx b/pgsql/types/test.hxx index f44d73e..462ebad 100644 --- a/pgsql/types/test.hxx +++ b/pgsql/types/test.hxx @@ -7,13 +7,13 @@ #include #include #include -#include // std::auto_ptr +#include // std::unique_ptr #include // std::memcmp, std::memcpy, std::str[n]cmp, std::strlen #include // std::size_t #include -#include +#include struct bitfield { @@ -71,7 +71,7 @@ operator== (const varbit& x, const varbit& y) #pragma db value(bitfield) type ("BIT(4)") -typedef std::auto_ptr string_ptr; +typedef std::unique_ptr string_ptr; enum color {red, green, blue}; diff --git a/pgsql/types/test.std b/pgsql/types/test.std deleted file mode 100644 index e69de29..0000000 diff --git a/pgsql/types/testscript b/pgsql/types/testscript new file mode 100644 index 0000000..57218e1 --- /dev/null +++ b/pgsql/types/testscript @@ -0,0 +1,11 @@ +# file : pgsql/types/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + ++$create_schema + +: basics +: +$* -- cgit v1.1