[odb-users] Is there some advice on recursive call back mechnism?
Music samal
zxbzswxr at gmail.com
Fri Oct 19 00:03:10 EDT 2018
I just want to construct some persist class as hierarchy structure...
it's somewhat like this ,A is the supreme class above which there are some
B s ,
B has some C s .....and it's linked with pointer
// it looks like that
class A
{
public:
A(string name_):name(name){}
A(){}
#pragma db id auto
long long id
string name ;
#pragma db inverse(pA)
vector<lazy_weak_ptr<B> >
string
}
class B
{
public:
B(string name):{}
B(){}
#pragma db id auto
long long id
string name;
#pragma db on_delete(cascade)
lazy_shared_ptr<A> pA
string qualifiedname;
}
as you see these classed have an number id the two string members, name
and qualifiedname,
suppose there is a B has name B1, its supper class A has name A1;
so the qualifiedname is A1.B1, it are linked names according to persist
classes hierarchy...
an A object A1 can have many children Bs, eg, B1,B2,B3 .... Also these Bs
has
qualified names which are A1.B1 , A1.B2, A1.B3...
persisting a B is easy, just get the upperclass A's qualifiedname .and
combine with B's name
if someday I want to update A1 . and modify its name as "A2" and update
this object A
what can I do to update children B's qualifiedname using odb-provided
callback mechism ?
and if B also have many C s , C also has name and qualified name? how to
deal with it?
it's something like trigger, modify a table trigger modifications to other
tables .I use postgres database .
can you help me????
More information about the odb-users
mailing list