aboutsummaryrefslogtreecommitdiff
path: root/common/virtual/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-08-31 15:47:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-08-31 15:47:55 +0200
commit3e6bb9e10626e192c5d56f806c3262c8ab489bad (patch)
tree64046ad3b8ba38fba604e3439f7f9abea0990cc5 /common/virtual/driver.cxx
parentc225be5dea36eaaa3df7f24d33a9644a9158b6a7 (diff)
Test handling multi-member composite object id using virtual data member
Diffstat (limited to 'common/virtual/driver.cxx')
-rw-r--r--common/virtual/driver.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/common/virtual/driver.cxx b/common/virtual/driver.cxx
index 05acfcb..1083cab 100644
--- a/common/virtual/driver.cxx
+++ b/common/virtual/driver.cxx
@@ -119,6 +119,31 @@ main (int argc, char* argv[])
t.commit ();
}
}
+
+ // Use virtual data members to implement multi-member composite object id.
+ //
+ {
+ using namespace test3;
+
+ person o;
+ o.first_ = "John";
+ o.last_ = "Doe";
+
+ name id;
+ {
+ transaction t (db->begin ());
+ id = db->persist (o);
+ t.commit ();
+ }
+
+ {
+ transaction t (db->begin ());
+ auto_ptr<person> p (db->load<person> (id));
+ t.commit ();
+
+ assert (o.first_ == p->first_ && o.last_ == p->last_);
+ }
+ }
}
catch (const odb::exception& e)
{