diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/query/driver.cxx | 18 | ||||
-rw-r--r-- | common/query/test.std | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/common/query/driver.cxx b/common/query/driver.cxx index 9ff596b..5a77ae9 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -383,6 +383,24 @@ main (int argc, char* argv[]) print (r); t.commit (); } + + // Test that loading of the same object type during iteration does + // not invalidate the result. + // + cout << "test 014" << endl; + { + transaction t (db->begin ()); + result r (db->query<person> (query::last_name == "Doe")); + + assert (r.size () == 2); + + result::iterator i (r.begin ()); + i++; + auto_ptr<person> joe (db->load<person> (3)); + assert (i->last_name_ == "Doe"); + + t.commit (); + } } catch (const odb::exception& e) { diff --git a/common/query/test.std b/common/query/test.std index e065765..14f3205 100644 --- a/common/query/test.std +++ b/common/query/test.std @@ -91,3 +91,4 @@ Johansen J Johansen 32 single test 013 Joe Squeaky Dirt 31 single +test 014 |