aboutsummaryrefslogtreecommitdiff
path: root/common/wrapper/test.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-27 13:32:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-27 13:32:46 +0200
commitedfd1193d15696c7a2e54573776b9121d6167e83 (patch)
tree7faab184b8bc1fe6b26d739e0adeac832fa534dc /common/wrapper/test.hxx
parentc8458a266eb258cf61b1e66066c72a2dc0f0ad8b (diff)
Support for NULL value semantics for composite values
Diffstat (limited to 'common/wrapper/test.hxx')
-rw-r--r--common/wrapper/test.hxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/common/wrapper/test.hxx b/common/wrapper/test.hxx
index ccf32b3..399073d 100644
--- a/common/wrapper/test.hxx
+++ b/common/wrapper/test.hxx
@@ -176,4 +176,58 @@ struct cont_object
cont_comp c; // Wrapped container in comp value.
};
+// Test composite NULL values.
+//
+#pragma db namespace table("t5_")
+namespace test5
+{
+ #pragma db value
+ struct base
+ {
+ base () {}
+ base (int n): num (n) {}
+
+ int num;
+ };
+
+ inline bool
+ operator== (const base& x, const base& y)
+ {
+ return x.num == y.num;
+ }
+
+ #pragma db value
+ struct comp: base
+ {
+ comp () {}
+ comp (int n, const std::string s): base (n), str (s), extra (n + 1) {}
+
+ std::string str;
+ base extra;
+
+ odb::nullable<int> always_null;
+ };
+
+ inline bool
+ operator== (const comp& x, const comp& y)
+ {
+ return static_cast<const base&> (x) == y &&
+ x.str == y.str && x.extra == y.extra;
+ }
+
+ #pragma db object
+ struct object
+ {
+ #pragma db id auto
+ unsigned long id;
+
+ #pragma db null
+ std::auto_ptr<comp> p;
+
+ odb::nullable<comp> n;
+
+ std::vector< odb::nullable<comp> > v;
+ };
+}
+
#endif // TEST_HXX