From 179eb696191958bae891916eec2708c4d3e34983 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 2 Sep 2013 09:22:39 +0200 Subject: Fix UPDATE statement for smart containers with read-only value members Here we have to include them (think what happens when we erase an element somewhere in the middle of a container). --- common/container/change-tracking/driver.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'common/container/change-tracking/driver.cxx') diff --git a/common/container/change-tracking/driver.cxx b/common/container/change-tracking/driver.cxx index 78f7a7f..9baf6a2 100644 --- a/common/container/change-tracking/driver.cxx +++ b/common/container/change-tracking/driver.cxx @@ -699,6 +699,34 @@ main (int argc, char* argv[]) t.commit (); } } + + // Test read-only values. + { + ro_object o (1); + o.v.push_back (ro_value (1, 1)); + o.v.push_back (ro_value (2, 2)); + o.v.push_back (ro_value (3, 3)); + + { + transaction t (db->begin ()); + db->persist (o); + t.commit (); + } + + o.v.erase (o.v.begin ()); + + { + transaction t (db->begin ()); + db->update (o); + t.commit (); + } + + { + transaction t (db->begin ()); + assert (db->load (1)->v == o.v); + t.commit (); + } + } } catch (const odb::exception& e) { -- cgit v1.1