aboutsummaryrefslogtreecommitdiff
path: root/common/inheritance/reuse/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-08 12:22:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-08 12:53:12 +0200
commit261863a5037ba892ec33eb037d77736c8e599369 (patch)
tree9474d4eb6915c32226576081df28c8b3ad8f4a2b /common/inheritance/reuse/driver.cxx
parentf4131327a7d768689b18dd9cc1c1c64fa6c21d1f (diff)
Test change-tracking container and reuse inheritance
Diffstat (limited to 'common/inheritance/reuse/driver.cxx')
-rw-r--r--common/inheritance/reuse/driver.cxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/common/inheritance/reuse/driver.cxx b/common/inheritance/reuse/driver.cxx
index 78c2703..89a1926 100644
--- a/common/inheritance/reuse/driver.cxx
+++ b/common/inheritance/reuse/driver.cxx
@@ -29,51 +29,73 @@ main (int argc, char* argv[])
base b;
b.comp_.bools.push_back (true);
+ b.comp_.obools.push_back (true);
b.comp_.num = 10;
b.comp_.str = "comp bbb";
b.comp_.nums.push_back (101);
b.comp_.nums.push_back (102);
+ b.comp_.onums.push_back (101);
+ b.comp_.onums.push_back (102);
b.num_ = 0;
b.str_ = "bbb";
b.strs_.push_back ("bbb one");
b.strs_.push_back ("bbb two");
+ b.ostrs_.push_back ("bbb one");
+ b.ostrs_.push_back ("bbb two");
object1 o1;
o1.comp_.bools.push_back (false);
+ o1.comp_.obools.push_back (false);
o1.comp_.num = 11;
o1.comp_.str = "comp o1o1o1";
o1.comp_.nums.push_back (111);
o1.comp_.nums.push_back (112);
+ o1.comp_.onums.push_back (111);
+ o1.comp_.onums.push_back (112);
static_cast<base&> (o1).num_ = 1;
o1.num1_ = 21;
o1.str_ = "base o1o1o1";
o1.strs_.push_back ("base o1o1o1 one");
o1.strs_.push_back ("base o1o1o1 two");
+ o1.ostrs_.push_back ("base o1o1o1 one");
+ o1.ostrs_.push_back ("base o1o1o1 two");
object2 o2;
o2.comp_.bools.push_back (true);
o2.comp_.bools.push_back (false);
+ o2.comp_.obools.push_back (true);
+ o2.comp_.obools.push_back (false);
o2.comp_.num = 12;
o2.comp_.str = "comp o2o2o2";
o2.comp_.nums.push_back (121);
o2.comp_.nums.push_back (122);
+ o2.comp_.onums.push_back (121);
+ o2.comp_.onums.push_back (122);
o2.num_ = 2;
static_cast<base&> (o2).str_ = "base o2o2o2";
o2.str_ = "o2o2o2";
o2.strs_.push_back ("base o2o2o2 one");
o2.strs_.push_back ("base o2o2o2 two");
+ o2.ostrs_.push_back ("base o2o2o2 one");
+ o2.ostrs_.push_back ("base o2o2o2 two");
object3 o3;
o3.comp_.bools.push_back (false);
o3.comp_.bools.push_back (false);
+ o3.comp_.obools.push_back (false);
+ o3.comp_.obools.push_back (false);
o3.comp_.num = 13;
o3.comp_.str = "comp o3o3o3";
o3.comp_.nums.push_back (131);
o3.comp_.nums.push_back (132);
+ o3.comp_.onums.push_back (131);
+ o3.comp_.onums.push_back (132);
o3.num_ = 3;
o3.str_ = "base o3o3o3";
o3.strs_.push_back ("base o3o3o3 one");
o3.strs_.push_back ("base o3o3o3 two");
+ o3.ostrs_.push_back ("base o3o3o3 one");
+ o3.ostrs_.push_back ("base o3o3o3 two");
reference r;
r.o1_ = &o1;
@@ -81,14 +103,20 @@ main (int argc, char* argv[])
empty e;
e.comp_.bools.push_back (true);
e.comp_.bools.push_back (true);
+ e.comp_.obools.push_back (true);
+ e.comp_.obools.push_back (true);
e.comp_.num = 14;
e.comp_.str = "comp eee";
e.comp_.nums.push_back (141);
e.comp_.nums.push_back (142);
+ e.comp_.onums.push_back (141);
+ e.comp_.onums.push_back (142);
e.num_ = 4;
e.str_ = "base eee";
e.strs_.push_back ("base eee one");
e.strs_.push_back ("base eee two");
+ e.ostrs_.push_back ("base eee one");
+ e.ostrs_.push_back ("base eee two");
// persist
//
@@ -125,6 +153,19 @@ main (int argc, char* argv[])
delete lr->o1_;
}
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (b);
+ db->update (o1);
+ db->update (o2);
+ db->update (o3);
+ db->update (r);
+ db->update (e);
+ t.commit ();
+ }
+
// query
//
{
@@ -173,6 +214,19 @@ main (int argc, char* argv[])
t.commit ();
}
+
+ // erase
+ //
+ {
+ transaction t (db->begin ());
+ db->erase (b);
+ db->erase (o1);
+ db->erase (o2);
+ db->erase (o3);
+ db->erase (r);
+ db->erase (e);
+ t.commit ();
+ }
}
catch (const odb::exception& e)
{