aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-05-04 21:01:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-05-04 21:01:22 +0200
commit01ba76036b5d9dbf57a0909869c4811f12ea8bee (patch)
tree477582ae69329bb4b297895120eef6f90ab50ce2 /common
parent841a7704f11b0c670e16e2f7278f9b3bdc6143c5 (diff)
Ignore section logic when dealing with container elements
The container member itself can be in a section.
Diffstat (limited to 'common')
-rw-r--r--common/section/basics/driver.cxx31
-rw-r--r--common/section/basics/test.hxx29
2 files changed, 60 insertions, 0 deletions
diff --git a/common/section/basics/driver.cxx b/common/section/basics/driver.cxx
index bdd5e64..b9fa667 100644
--- a/common/section/basics/driver.cxx
+++ b/common/section/basics/driver.cxx
@@ -1694,6 +1694,37 @@ main (int argc, char* argv[])
t.commit ();
}
}
+
+ // Regression: BLOB in a value type used as a map value that is in a
+ // section.
+ //
+ {
+ using namespace test19;
+
+ object o;
+ o.m[1].b.assign (560, 'x'); // Size greater than the default image.
+
+ {
+ transaction t (db->begin ());
+ db->persist (o);
+ t.commit ();
+ }
+
+ {
+ // Hold "old" connection to force a new set of statements/image
+ // buffers.
+ //
+ connection_ptr c (db->connection ());
+
+ transaction t (db->begin ());
+ auto_ptr<object> p (db->load<object> (o.id));
+
+ db->load (*p, p->s);
+ assert (p->m[1].b == o.m[1].b);
+
+ t.commit ();
+ }
+ }
}
catch (const odb::exception& e)
{
diff --git a/common/section/basics/test.hxx b/common/section/basics/test.hxx
index 60b69da..9dcb48a 100644
--- a/common/section/basics/test.hxx
+++ b/common/section/basics/test.hxx
@@ -597,4 +597,33 @@ namespace test18
};
}
+// Regression: BLOB in a value type used as a map value that is in a section.
+//
+#include <map>
+#include <vector>
+
+#pragma db namespace table("t19_")
+namespace test19
+{
+ #pragma db value
+ struct value
+ {
+ #pragma db type(BLOB_TYPE)
+ std::vector<char> b;
+ };
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db load(lazy) update(always)
+ odb::section s;
+
+ #pragma db section(s)
+ std::map<int, value> m;
+ };
+}
+
#endif // TEST_HXX