QxOrm might have relations?

Forum for posting problems using QxOrm library

QxOrm might have relations?

Postby fuzz » Tue Apr 09, 2013 9:13 pm

Is it possible to layout a might-have relationship with QxOrm? I'm reading the tutorial and I don't think this case is covered.

Example? A person might have a rank:

Code: Select all
Table person
id | name | rank_id
1  | Me   | NULL
2  | You  | 100

Table rank
id  | name
100 | Hacker


So person "Me" got no rank and person "You" is hacker. Can I cover this case with QxOrm? Or it this the many-to-one case?
fuzz
 
Posts: 1
Joined: Tue Apr 02, 2013 8:22 pm

Re: QxOrm might have relations?

Postby qxorm » Wed Apr 10, 2013 7:22 am

Hi,

So person "Me" got no rank and person "You" is hacker.
Can I cover this case with QxOrm? Or it this the many-to-one case?

Yes this is a many-to-one relationship, and if you define a pointer to a hacker, just put a NULL pointer before inserting it in the database (or use boost::optional, but here a pointer seems a better idea).
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 12 guests

cron