diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/inheritance/polymorphism/driver.cxx | 16 | ||||
-rw-r--r-- | common/inheritance/polymorphism/test4.hxx | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/common/inheritance/polymorphism/driver.cxx b/common/inheritance/polymorphism/driver.cxx index 672473c..d4509a4 100644 --- a/common/inheritance/polymorphism/driver.cxx +++ b/common/inheritance/polymorphism/driver.cxx @@ -968,6 +968,22 @@ main (int argc, char* argv[]) t.commit (); } + + { + typedef odb::result<view3> result; + + transaction t (db->begin ()); + + { + result qr (db->query<view3> ()); + result::iterator i (qr.begin ()), e (qr.end ()); + + assert (i != e && i->str == "abc"); + assert (++i == e); + } + + t.commit (); + } } // Test 5: polymorphism and optimistic concurrency. diff --git a/common/inheritance/polymorphism/test4.hxx b/common/inheritance/polymorphism/test4.hxx index 0bd53bd..5c4ae2f 100644 --- a/common/inheritance/polymorphism/test4.hxx +++ b/common/inheritance/polymorphism/test4.hxx @@ -71,6 +71,15 @@ namespace test4 #pragma db column("min(" + base2::num + ")") unsigned long min_num; }; + + // Test custom join condition that uses object id. It cannot come + // from the base since the base table hasn't been join'ed yet. + // + #pragma db view object(base1) object(base2: base2::id == base1::id) + struct view3 + { + std::string str; + }; } #endif // TEST4_HXX |