From ae6dd84a3b61063a595efb2cd02eff01b0185546 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Aug 2012 11:16:20 +0200 Subject: Add support for empty column names in composite value types --- common/composite/driver.cxx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'common/composite/driver.cxx') 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 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 o1 (db->load (1)); + t.commit (); + + assert (o == *o1); + } + } } catch (const odb::exception& e) { -- cgit v1.1