diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-04 12:57:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-17 12:04:03 +0200 |
commit | a53a1dc7361ac340d7942e5b41d72cb918ead2a7 (patch) | |
tree | d9675ddadaa0430624ea8e005c76db21b8f77603 /evolution/soft-delete/model.hxx | |
parent | d3689b6cd0b01ea4872cefbe99dbaef95febd64d (diff) |
Container versioning support
Diffstat (limited to 'evolution/soft-delete/model.hxx')
-rw-r--r-- | evolution/soft-delete/model.hxx | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/evolution/soft-delete/model.hxx b/evolution/soft-delete/model.hxx index 1690583..78a4cfe 100644 --- a/evolution/soft-delete/model.hxx +++ b/evolution/soft-delete/model.hxx @@ -9,7 +9,7 @@ #include <string> #include <odb/core.hxx> -#include <odb/nullable.hxx> +#include <odb/vector.hxx> #include <common/config.hxx> // DATABASE_XXX @@ -60,10 +60,12 @@ namespace MODEL_NAMESPACE(MODEL_VERSION) std::string str; unsigned long num; + odb::vector<int> vec; }; #if MODEL_VERSION == 3 #pragma db member(object::str) deleted(3) + #pragma db member(object::vec) deleted(3) #endif } @@ -115,8 +117,60 @@ namespace MODEL_NAMESPACE(MODEL_VERSION) #endif } + // Test container with soft-deleted value member. + // + #pragma db namespace table("t5_") + namespace test5 + { + #pragma db value + struct value + { + value () {} + value (const std::string& s, unsigned long n): str (s), num (n) {} + + std::string str; + unsigned long num; + }; + + #pragma db object + struct object + { + object (unsigned long id = 0): id_ (id) {} + + #pragma db id + unsigned long id_; + + odb::vector<value> vec; + }; + +#if MODEL_VERSION == 3 + #pragma db member(value::str) deleted(3) +#endif + } + #endif // DATABASE_SQLITE + // Test soft-deleted container member in a non-versioned object. + // + #pragma db namespace table("t21_") + namespace test21 + { + #pragma db object + struct object + { + object (unsigned long id = 0): id_ (id) {} + + #pragma db id + unsigned long id_; + + unsigned long num; + odb::vector<int> vec; + }; + +#if MODEL_VERSION == 3 + #pragma db member(object::vec) deleted(3) +#endif + } } #undef MODEL_NAMESPACE |