[odb-users] deleting entries on relation table

Simón Emmanuel Gutiérrez Brida simon.gutierrez.brida at gmail.com
Wed Jan 29 15:20:05 EST 2014


Hi,

I have two classes

User with these members

#pragma db id
std::string id;

#pragma db value_not_null
std::vector<std::tr1::shared_ptr<Pattern> > patterns;

Pattern with these members

#pragma db id
std::string id;

#pragma db map type("XML")       \
              as("TEXT")        \
              to("XMLPARSE(DOCUMENT (?))") \
              from("XMLSERIALIZE(DOCUMENT (?) AS TEXT)")
#pragma db type("XML")
std::string data;

And I get a table for each class plus a table that relates a User with a
Pattern.

Now I want to delete a pattern but in order to do that I have to delete all
entries in the relationship table that have the pattern id in the pattern
column.

Unfortunately there's no delete example using a one-to-many relation and
the manual is not very helpful in this case, could someone help me with
this?

Thanks.


More information about the odb-users mailing list