aboutsummaryrefslogtreecommitdiff
path: root/common/inheritance/polymorphism
diff options
context:
space:
mode:
Diffstat (limited to 'common/inheritance/polymorphism')
-rw-r--r--common/inheritance/polymorphism/.gitignore76
-rw-r--r--common/inheritance/polymorphism/buildfile52
-rw-r--r--common/inheritance/polymorphism/driver.cxx159
-rw-r--r--common/inheritance/polymorphism/makefile120
-rw-r--r--common/inheritance/polymorphism/test.std36
-rw-r--r--common/inheritance/polymorphism/test5.hxx6
-rw-r--r--common/inheritance/polymorphism/test6.hxx10
-rw-r--r--common/inheritance/polymorphism/test7.hxx12
-rw-r--r--common/inheritance/polymorphism/testscript80
9 files changed, 240 insertions, 311 deletions
diff --git a/common/inheritance/polymorphism/.gitignore b/common/inheritance/polymorphism/.gitignore
new file mode 100644
index 0000000..f183a6f
--- /dev/null
+++ b/common/inheritance/polymorphism/.gitignore
@@ -0,0 +1,76 @@
+# ODB-generated files.
+#
+test1-odb.?xx
+test1-odb-*.?xx
+test1.sql
+test1-*.sql
+
+test2-odb.?xx
+test2-odb-*.?xx
+test2.sql
+test2-*.sql
+
+test3-odb.?xx
+test3-odb-*.?xx
+test3.sql
+test3-*.sql
+
+test4-odb.?xx
+test4-odb-*.?xx
+test4.sql
+test4-*.sql
+
+test5-odb.?xx
+test5-odb-*.?xx
+test5.sql
+test5-*.sql
+
+test6-odb.?xx
+test6-odb-*.?xx
+test6.sql
+test6-*.sql
+
+test7-odb.?xx
+test7-odb-*.?xx
+test7.sql
+test7-*.sql
+
+test8-odb.?xx
+test8-odb-*.?xx
+test8.sql
+test8-*.sql
+
+test9-odb.?xx
+test9-odb-*.?xx
+test9.sql
+test9-*.sql
+
+test10-odb.?xx
+test10-odb-*.?xx
+test10.sql
+test10-*.sql
+
+test11-odb.?xx
+test11-odb-*.?xx
+test11.sql
+test11-*.sql
+
+test12-odb.?xx
+test12-odb-*.?xx
+test12.sql
+test12-*.sql
+
+test13-odb.?xx
+test13-odb-*.?xx
+test13.sql
+test13-*.sql
+
+test14-odb.?xx
+test14-odb-*.?xx
+test14.sql
+test14-*.sql
+
+test15-odb.?xx
+test15-odb-*.?xx
+test15.sql
+test15-*.sql
diff --git a/common/inheritance/polymorphism/buildfile b/common/inheritance/polymorphism/buildfile
new file mode 100644
index 0000000..846eb12
--- /dev/null
+++ b/common/inheritance/polymorphism/buildfile
@@ -0,0 +1,52 @@
+# file : common/inheritance/polymorphism/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}
+
+hs = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
+ test12 test13 test14 test15
+
+exe{driver}: {hxx cxx}{* -*-odb -*-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
+
+for h: $hs
+{
+ exe{driver}: {hxx ixx cxx}{$h-odb}
+
+ <{hxx ixx cxx}{$h-odb}>: hxx{$h} libue{test-meta}
+
+ for db: $databases
+ {
+ exe{driver}: {hxx ixx cxx}{$h-odb-$db}: include = $multi
+ <{hxx ixx cxx}{$h-odb-$db}>: hxx{$h} 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 inhrt_p_ \
+ --generate-schema \
+ --generate-query \
+ --generate-prepared
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
+
+# Testscript's run-time prerequisites.
+#
+exe{driver}: ../../../alias{database-client}: include = adhoc
+
+testscript@./: schemas = $hs
diff --git a/common/inheritance/polymorphism/driver.cxx b/common/inheritance/polymorphism/driver.cxx
index 6d4e615..12f4666 100644
--- a/common/inheritance/polymorphism/driver.cxx
+++ b/common/inheritance/polymorphism/driver.cxx
@@ -4,15 +4,14 @@
// Test polymorphic object inheritance.
//
-#include <memory> // std::auto_ptr
-#include <cassert>
+#include <memory> // std::unique_ptr
#include <iostream>
#include <odb/database.hxx>
#include <odb/session.hxx>
#include <odb/transaction.hxx>
-#include <common/common.hxx>
+#include <libcommon/common.hxx>
#include "test1.hxx"
#include "test2.hxx"
@@ -46,6 +45,9 @@
#include "test14-odb.hxx"
#include "test15-odb.hxx"
+#undef NDEBUG
+#include <cassert>
+
using namespace std;
using namespace odb::core;
@@ -87,7 +89,7 @@ main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ unique_ptr<database> db (create_database (argc, argv));
// Test 1: basic polymorphism functionality.
//
@@ -136,9 +138,9 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
- auto_ptr<root> pr (db->load<root> (r.id));
- auto_ptr<base> pb (db->load<base> (b.id));
- auto_ptr<derived> pd (db->load<derived> (d.id));
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
t.commit ();
assert (*pr == r);
@@ -150,9 +152,9 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
- auto_ptr<root> pb (db->load<root> (b.id));
- auto_ptr<root> pd1 (db->load<root> (d.id));
- auto_ptr<base> pd2 (db->load<base> (d.id));
+ unique_ptr<root> pb (db->load<root> (b.id));
+ unique_ptr<root> pd1 (db->load<root> (d.id));
+ unique_ptr<base> pd2 (db->load<base> (d.id));
t.commit ();
assert (*pb == b);
@@ -167,14 +169,14 @@ main (int argc, char* argv[])
try
{
- auto_ptr<base> p (db->load<base> (r.id));
+ unique_ptr<base> p (db->load<base> (r.id));
assert (false);
}
catch (const object_not_persistent&) {}
try
{
- auto_ptr<derived> p (db->load<derived> (b.id));
+ unique_ptr<derived> p (db->load<derived> (b.id));
assert (false);
}
catch (const object_not_persistent&) {}
@@ -452,14 +454,14 @@ main (int argc, char* argv[])
if (ds == "test1::base")
{
- auto_ptr<derived> d1 (db->load<derived> (d.id));
+ unique_ptr<derived> d1 (db->load<derived> (d.id));
assert (*d1 == d);
assert (*i == b);
mask |= 1;
}
else if (ds == "test1::derived")
{
- auto_ptr<base> b1 (db->load<base> (b.id));
+ unique_ptr<base> b1 (db->load<base> (b.id));
assert (*b1 == b);
assert (*i == d);
mask |= 2;
@@ -562,9 +564,9 @@ main (int argc, char* argv[])
//
{
transaction t (db->begin ());
- auto_ptr<root> pr (db->load<root> (r.id));
- auto_ptr<base> pb (db->load<base> (b.id));
- auto_ptr<derived> pd (db->load<derived> (d.id));
+ unique_ptr<root> pr (db->load<root> (r.id));
+ unique_ptr<base> pb (db->load<base> (b.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
t.commit ();
assert (*pr == r);
@@ -661,9 +663,9 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
- auto_ptr<derived> pd (db->load<derived> (d.id));
- auto_ptr<base> pb (db->load<base> (d.id));
- auto_ptr<root> pr (db->load<root> (d.id));
+ unique_ptr<derived> pd (db->load<derived> (d.id));
+ unique_ptr<base> pb (db->load<base> (d.id));
+ unique_ptr<root> pr (db->load<root> (d.id));
t.commit ();
assert (pd->rp.object_id<root_pointer> () == rp.id &&
@@ -791,18 +793,18 @@ main (int argc, char* argv[])
transaction t (db->begin ());
{
- auto_ptr<base> p1 (db->load<base> (b1.id));
- auto_ptr<base> p2 (db->load<base> (b2.id));
- auto_ptr<root> p3 (db->load<root> (b3.id));
+ unique_ptr<base> p1 (db->load<base> (b1.id));
+ unique_ptr<base> p2 (db->load<base> (b2.id));
+ unique_ptr<root> p3 (db->load<root> (b3.id));
assert (*p1 == b1);
assert (*p2 == b2);
assert (*p3 == b3);
}
{
- auto_ptr<derived> p1 (db->load<derived> (d1.id));
- auto_ptr<base> p2 (db->load<base> (d2.id));
- auto_ptr<root> p3 (db->load<root> (d3.id));
+ unique_ptr<derived> p1 (db->load<derived> (d1.id));
+ unique_ptr<base> p2 (db->load<base> (d2.id));
+ unique_ptr<root> p3 (db->load<root> (d3.id));
assert (*p1 == d1);
assert (*p2 == d2);
assert (*p3 == d3);
@@ -1028,11 +1030,7 @@ main (int argc, char* argv[])
// Root.
//
{
-#ifdef HAVE_CXX11
unique_ptr<root> p (db->load<root> (r.id));
-#else
- auto_ptr<root> p (db->load<root> (r.id));
-#endif
r.num++;
r.strs.push_back ("aaaa");
@@ -1056,11 +1054,7 @@ main (int argc, char* argv[])
// Base.
//
{
-#ifdef HAVE_CXX11
unique_ptr<base> p (db->load<base> (b.id));
-#else
- auto_ptr<base> p (db->load<base> (b.id));
-#endif
b.num++;
b.str += "b";
@@ -1088,11 +1082,7 @@ main (int argc, char* argv[])
// Derived.
//
{
-#ifdef HAVE_CXX11
unique_ptr<root> p (db->load<root> (d.id)); // Via root.
-#else
- auto_ptr<root> p (db->load<root> (d.id)); // Via root.
-#endif
d.num++;
d.str += "d";
@@ -1156,11 +1146,7 @@ main (int argc, char* argv[])
// Root.
//
{
-#ifdef HAVE_CXX11
unique_ptr<root> p (db->load<root> (r.id));
-#else
- auto_ptr<root> p (db->load<root> (r.id));
-#endif
r.num++;
r.strs.push_back ("aaaaa");
@@ -1180,11 +1166,7 @@ main (int argc, char* argv[])
// Base.
//
{
-#ifdef HAVE_CXX11
unique_ptr<base> p (db->load<base> (b.id));
-#else
- auto_ptr<base> p (db->load<base> (b.id));
-#endif
b.num++;
b.str += "b";
@@ -1206,11 +1188,7 @@ main (int argc, char* argv[])
// Derived.
//
{
-#ifdef HAVE_CXX11
unique_ptr<root> p (db->load<root> (d.id)); // Via root.
-#else
- auto_ptr<root> p (db->load<root> (d.id)); // Via root.
-#endif
d.num++;
d.str += "d";
@@ -1264,11 +1242,7 @@ main (int argc, char* argv[])
base b (1, 1, "bbb");
-#ifdef HAVE_CXX11
unique_ptr<base> d (new derived (2, 2, "ddd"));
-#else
- auto_ptr<base> d (new derived (2, 2, "ddd"));
-#endif
// Persist.
//
@@ -1284,13 +1258,8 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<base> pb (db->load<base> (b.id));
unique_ptr<root> pd (db->load<root> (d->id));
-#else
- auto_ptr<base> pb (db->load<base> (b.id));
- auto_ptr<root> pd (db->load<root> (d->id));
-#endif
db->load (b.id, *pb);
db->load (d->id, *pd);
@@ -1353,11 +1322,7 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<root> p (db->load<root> (d.id));
-#else
- auto_ptr<root> p (db->load<root> (d.id));
-#endif
t.commit ();
}
}
@@ -1365,7 +1330,6 @@ main (int argc, char* argv[])
// Test 7: polymorphism and object cache (session).
//
-#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY)
{
using namespace test7;
@@ -1468,7 +1432,6 @@ main (int argc, char* argv[])
}
}
}
-#endif
// Test 8: polymorphism and abstract bases.
//
@@ -1517,15 +1480,9 @@ main (int argc, char* argv[])
// load (id)
//
-#ifdef HAVE_CXX11
unique_ptr<root> pb (db->load<root> (b.id));
unique_ptr<interm> pd1 (db->load<interm> (d1.id));
unique_ptr<derived2> pd2 (db->load<derived2> (d2.id));
-#else
- auto_ptr<root> pb (db->load<root> (b.id));
- auto_ptr<interm> pd1 (db->load<interm> (d1.id));
- auto_ptr<derived2> pd2 (db->load<derived2> (d2.id));
-#endif
assert (*pb == b);
assert (*pd1 == d1);
@@ -1608,15 +1565,9 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<base> pb (db->load<base> (b.id));
unique_ptr<root> pd1 (db->load<root> (d1.id));
unique_ptr<base> pd2 (db->load<base> (d2.id));
-#else
- auto_ptr<base> pb (db->load<base> (b.id));
- auto_ptr<root> pd1 (db->load<root> (d1.id));
- auto_ptr<base> pd2 (db->load<base> (d2.id));
-#endif
t.commit ();
@@ -1743,7 +1694,6 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<ro_root> p_ro_r (db->load<ro_root> (ro_r.id));
unique_ptr<ro_root> p_rw_b (db->load<ro_root> (rw_b.id));
unique_ptr<ro_root> p_ro_d (db->load<ro_root> (ro_d.id));
@@ -1751,15 +1701,6 @@ main (int argc, char* argv[])
unique_ptr<rw_root> p_rw_r (db->load<rw_root> (rw_r.id));
unique_ptr<rw_root> p_ro_b (db->load<rw_root> (ro_b.id));
unique_ptr<rw_root> p_rw_d (db->load<rw_root> (rw_d.id));
-#else
- auto_ptr<ro_root> p_ro_r (db->load<ro_root> (ro_r.id));
- auto_ptr<ro_root> p_rw_b (db->load<ro_root> (rw_b.id));
- auto_ptr<ro_root> p_ro_d (db->load<ro_root> (ro_d.id));
-
- auto_ptr<rw_root> p_rw_r (db->load<rw_root> (rw_r.id));
- auto_ptr<rw_root> p_ro_b (db->load<rw_root> (ro_b.id));
- auto_ptr<rw_root> p_rw_d (db->load<rw_root> (rw_d.id));
-#endif
t.commit ();
@@ -1795,13 +1736,8 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<root> pb (db->load<root> (b.id));
unique_ptr<root> pd (db->load<root> (d.id));
-#else
- auto_ptr<root> pb (db->load<root> (b.id));
- auto_ptr<root> pd (db->load<root> (d.id));
-#endif
t.commit ();
assert (*pb == b);
@@ -1825,13 +1761,8 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<root> pb (db->load<root> (b.id));
unique_ptr<root> pd (db->load<root> (d.id));
-#else
- auto_ptr<root> pb (db->load<root> (b.id));
- auto_ptr<root> pd (db->load<root> (d.id));
-#endif
t.commit ();
assert (*pb == b);
@@ -1867,13 +1798,8 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<base> pb (db->load<base> (b.id));
unique_ptr<base> pd (db->load<base> (d.id));
-#else
- auto_ptr<base> pb (db->load<base> (b.id));
- auto_ptr<base> pd (db->load<base> (d.id));
-#endif
t.commit ();
assert (*pb == b);
@@ -1906,13 +1832,8 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<base> pb (db->load<base> (b.id));
unique_ptr<base> pd (db->load<base> (d.id));
-#else
- auto_ptr<base> pb (db->load<base> (b.id));
- auto_ptr<base> pd (db->load<base> (d.id));
-#endif
t.commit ();
@@ -1975,13 +1896,8 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<root> pb (db->load<root> (id1));
unique_ptr<root> pd (db->load<root> (id2));
-#else
- auto_ptr<root> pb (db->load<root> (id1));
- auto_ptr<root> pd (db->load<root> (id2));
-#endif
t.commit ();
@@ -2019,17 +1935,10 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<root> pbr (db->load<root> (b.id));
unique_ptr<root> pdr (db->load<root> (d.id));
unique_ptr<base> pdb (db->load<base> (d.id));
unique_ptr<root> pb1r (db->load<root> (b1.id));
-#else
- auto_ptr<root> pbr (db->load<root> (b.id));
- auto_ptr<root> pdr (db->load<root> (d.id));
- auto_ptr<base> pdb (db->load<base> (d.id));
- auto_ptr<root> pb1r (db->load<root> (b1.id));
-#endif
t.commit ();
base& rb (static_cast<base&> (*pbr));
@@ -2083,10 +1992,10 @@ main (int argc, char* argv[])
object4* p4 (db->load<object4> (d.o4[0]->id));
t.commit ();
- assert (p1->d->num = d.num);
- assert (p2->d[0]->num = d.num);
- assert (p3->d[0]->num = d.num);
- assert (p4->d->num = d.num);
+ assert (p1->d->num == d.num);
+ assert (p2->d[0]->num == d.num);
+ assert (p3->d[0]->num == d.num);
+ assert (p4->d->num == d.num);
delete p1->d;
}
@@ -2149,11 +2058,7 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifdef HAVE_CXX11
unique_ptr<base> pb (db->load<base> (d.id));
-#else
- auto_ptr<base> pb (db->load<base> (d.id));
-#endif
t.commit ();
derived* pd (dynamic_cast<derived*> (pb.get ()));
diff --git a/common/inheritance/polymorphism/makefile b/common/inheritance/polymorphism/makefile
deleted file mode 100644
index 2b969f5..0000000
--- a/common/inheritance/polymorphism/makefile
+++ /dev/null
@@ -1,120 +0,0 @@
-# file : common/inheritance/polymorphism/makefile
-# license : GNU GPL v2; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-odb_hdr := test1.hxx test2.hxx test3.hxx test4.hxx test5.hxx test6.hxx \
-test7.hxx test8.hxx test9.hxx test10.hxx test11.hxx test12.hxx test13.hxx \
-test14.hxx test15.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-prepared --table-prefix inhrt_p_
-$(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 odb_header_stem := $(basename $(odb_hdr))
-$(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,,$(filter %.sql,$(gen))))
-else
-$(foreach d,$(databases),$(eval $(call test-rule,$d,$(filter %.sql,$(gen)))))
-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/inheritance/polymorphism/test.std b/common/inheritance/polymorphism/test.std
deleted file mode 100644
index 5c18191..0000000
--- a/common/inheritance/polymorphism/test.std
+++ /dev/null
@@ -1,36 +0,0 @@
-base pre_persist 1 const
-base post_persist 1 const
-derived pre_persist 2 const
-derived post_persist 2 const
-base pre_load 0
-base post_load 1
-derived pre_load 0 const
-derived post_load 2 const
-base pre_load 1
-base post_load 1
-derived pre_load 2 const
-derived post_load 2 const
-base pre_load 1
-base post_load 1
-derived pre_load 2 const
-derived post_load 2 const
-base pre_update 1 const
-base post_update 1 const
-derived pre_update 2 const
-derived post_update 2 const
-base pre_load 0
-base post_load 1
-derived pre_load 0 const
-derived post_load 2 const
-base pre_erase 1 const
-base post_erase 1 const
-derived pre_erase 2 const
-derived post_erase 2 const
-derived pre_persist 3 const
-derived post_persist 3 const
-derived pre_persist 4 const
-derived post_persist 4 const
-derived pre_load 0 const
-derived pre_load 0 const
-derived post_load 4 const
-derived post_load 3 const
diff --git a/common/inheritance/polymorphism/test5.hxx b/common/inheritance/polymorphism/test5.hxx
index e6dba8d..172e7e8 100644
--- a/common/inheritance/polymorphism/test5.hxx
+++ b/common/inheritance/polymorphism/test5.hxx
@@ -4,8 +4,6 @@
#ifndef TEST5_HXX
#define TEST5_HXX
-#include <common/config.hxx> // HAVE_CXX11
-
#include <string>
#include <vector>
#include <memory>
@@ -18,11 +16,7 @@
#pragma db namespace table("t5_")
namespace test5
{
-#ifdef HAVE_CXX11
#pragma db object polymorphic optimistic pointer(std::unique_ptr)
-#else
- #pragma db object polymorphic optimistic pointer(std::auto_ptr)
-#endif
struct root
{
virtual ~root () {}
diff --git a/common/inheritance/polymorphism/test6.hxx b/common/inheritance/polymorphism/test6.hxx
index 1e42400..b0f9a16 100644
--- a/common/inheritance/polymorphism/test6.hxx
+++ b/common/inheritance/polymorphism/test6.hxx
@@ -4,8 +4,6 @@
#ifndef TEST6_HXX
#define TEST6_HXX
-#include <common/config.hxx> // HAVE_CXX11
-
#include <string>
#include <memory>
@@ -17,11 +15,7 @@
#pragma db namespace table("t6_")
namespace test6
{
-#ifdef HAVE_CXX11
#pragma db object polymorphic pointer(std::unique_ptr)
-#else
- #pragma db object polymorphic pointer(std::auto_ptr)
-#endif
struct root
{
virtual ~root () {}
@@ -60,11 +54,7 @@ namespace test6
unsigned long dnum;
std::string dstr;
-#ifdef HAVE_CXX11
std::unique_ptr<root> ptr;
-#else
- std::auto_ptr<root> ptr;
-#endif
void
db_callback (odb::callback_event, odb::database&) const;
diff --git a/common/inheritance/polymorphism/test7.hxx b/common/inheritance/polymorphism/test7.hxx
index 6edb834..60da98e 100644
--- a/common/inheritance/polymorphism/test7.hxx
+++ b/common/inheritance/polymorphism/test7.hxx
@@ -4,28 +4,17 @@
#ifndef TEST7_HXX
#define TEST7_HXX
-#include <common/config.hxx> // HAVE_CXX11, HAVE_TR1_MEMORY
-
#include <string>
#include <memory>
-#if !defined(HAVE_CXX11) && defined(HAVE_TR1_MEMORY)
-# include <odb/tr1/memory.hxx>
-#endif
-
#include <odb/core.hxx>
// Test polymorphism and object cache (session).
//
-#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY)
#pragma db namespace table("t7_")
namespace test7
{
-#ifdef HAVE_CXX11
using std::shared_ptr;
-#else
- using std::tr1::shared_ptr;
-#endif
#pragma db object polymorphic pointer(shared_ptr) session
struct root
@@ -61,6 +50,5 @@ namespace test7
std::string dstr;
};
}
-#endif
#endif // TEST7_HXX
diff --git a/common/inheritance/polymorphism/testscript b/common/inheritance/polymorphism/testscript
new file mode 100644
index 0000000..89e5726
--- /dev/null
+++ b/common/inheritance/polymorphism/testscript
@@ -0,0 +1,80 @@
+# file : common/inheritance/polymorphism/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+
++cat <<EOI >=output
+ base pre_persist 1 const
+ base post_persist 1 const
+ derived pre_persist 2 const
+ derived post_persist 2 const
+ base pre_load 0
+ base post_load 1
+ derived pre_load 0 const
+ derived post_load 2 const
+ base pre_load 1
+ base post_load 1
+ derived pre_load 2 const
+ derived post_load 2 const
+ base pre_load 1
+ base post_load 1
+ derived pre_load 2 const
+ derived post_load 2 const
+ base pre_update 1 const
+ base post_update 1 const
+ derived pre_update 2 const
+ derived post_update 2 const
+ base pre_load 0
+ base post_load 1
+ derived pre_load 0 const
+ derived post_load 2 const
+ base pre_erase 1 const
+ base post_erase 1 const
+ derived pre_erase 2 const
+ derived post_erase 2 const
+ derived pre_persist 3 const
+ derived post_persist 3 const
+ derived pre_persist 4 const
+ derived post_persist 4 const
+ derived pre_load 0 const
+ derived pre_load 0 const
+ derived post_load 4 const
+ derived post_load 3 const
+ EOI
+
+test.redirects += >>>../output
+
+: mysql
+:
+if $mysql
+{
+ .include ../../../mysql-schema.testscript
+
+ for s: $schemas
+ cat $out_base/"$s"($multi ? '-mysql' : '').sql | $create_schema_cmd
+ end;
+
+ $* ($multi ? 'mysql' : ) $mysql_options
+}
+
+: sqlite
+:
+if $sqlite
+{
+ .include ../../../sqlite.testscript
+
+ $*
+}
+
+: pgsql
+:
+if $pgsql
+{
+ .include ../../../pgsql-schema.testscript
+
+ for s: $schemas
+ $create_schema_cmd -f $out_base/"$s"($multi ? '-pgsql' : '').sql
+ end;
+
+ $* ($multi ? 'pgsql' : ) $pgsql_options
+}