[odb-users] Relationships and constraints without pointers
Boris Kolpackov
boris at codesynthesis.com
Wed Jan 23 08:21:04 EST 2019
Troy Heron <troy.heron at hixxy.org> writes:
> struct Object1
> {
> std::set<std::string> values;
> };
>
> struct Object2
> {
> std::set<std::string> values;
> };
>
> Is it possible for me to create a relationship and constraints using
> pragmas and no additional objects or pointers [...]
In 2.5.0[1] there is the new points_to pragma for that. For example:
struct Object1
{
#pragma db points_to(Object2)
std::string value;
};
It does not yet support containers of pointers, however.
> [...] such that the values in Object2::values can only be those in
> Object1::values and that Object2::values is updated when a value is
> removed from Object1::values or when the value is changed?
I assume you are alluding to the ON DELETE/ON UPDATE mechanism. There
is the on_delete pragma but there is no on_update.
[1] https://codesynthesis.com/products/odb/doc/install-build2.xhtml
More information about the odb-users
mailing list