diff options
Diffstat (limited to 'common/virtual/driver.cxx')
-rw-r--r-- | common/virtual/driver.cxx | 25 |
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) { |