diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-01 11:16:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-01 11:16:20 +0200 |
commit | ae6dd84a3b61063a595efb2cd02eff01b0185546 (patch) | |
tree | 481eb6c513de2f479b0f5064fd56739a738e897f /common/composite/driver.cxx | |
parent | 54f820b0d4a1cb614753c333bd78feb9ed579aad (diff) |
Add support for empty column names in composite value types
Diffstat (limited to 'common/composite/driver.cxx')
-rw-r--r-- | common/composite/driver.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/common/composite/driver.cxx b/common/composite/driver.cxx index 4f4d720..a7bc26e 100644 --- a/common/composite/driver.cxx +++ b/common/composite/driver.cxx @@ -27,8 +27,12 @@ main (int argc, char* argv[]) { auto_ptr<database> db (create_database (argc, argv)); + // Test basic composite functionality. + // for (unsigned short i (0); i < 2; ++i) { + using namespace test1; + person p (1); p.name_.first = "Joe"; p.name_.last = "Dirt"; @@ -125,6 +129,8 @@ main (int argc, char* argv[]) // Test composite class template instantiation. // { + using namespace test2; + object o (1); o.comp_.num = 123; @@ -158,6 +164,33 @@ main (int argc, char* argv[]) assert (o == *o1); } } + + // Test empty column name. + // + { + using namespace test3; + + object o (1); + o.c_.str = "abc"; + + // persist + // + { + transaction t (db->begin ()); + db->persist (o); + t.commit (); + } + + // load & check + // + { + transaction t (db->begin ()); + auto_ptr<object> o1 (db->load<object> (1)); + t.commit (); + + assert (o == *o1); + } + } } catch (const odb::exception& e) { |