You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I see that Nut::Row sharedpointers have fields related to their foreign keys. But they are always null. I want to be able to access those objects directly from the child table. Is this possible? Am I doing something wrong?
For example I have two tables, posts and comments:
"Comment" class has "Post" as foreign key. And "Post" class has "comments" as child table. Now, when I get a comment row with;
Nut::Row c = db.comments()->query()->first();
Here pointer "c" contains fields as postId and post. postId shows the related post's id. It is fine. BUT field "post" is always null. However it would be awesome if I could access to object post like this:
QString pn = c->post->postname(); // currently this line throws error, the app crashes, because c->post is nullptr.
I tried "join" but result is the same. post is always null.
Nut::Row c = db.comments()->query()->join()->first();
QString pn = c->post->postname(); // result is same as above.
Development platform:
OS: ubuntu 18.04
Qt creator 4.13.0, based on Qt 5.15.0
Compiler GCC 5.3.1
Nut commit hash: Commit 6ce50e2 by Jack Lilhammers, 07/07/2020 05:50 PM // this is the commit you used in OrmTest repo.
Serializer commit hash: Commit b0194da3 by Miklós Márton, 06/13/2020 12:00 AM // this is the commit you used in OrmTest repo.
Thank you in advance.
The text was updated successfully, but these errors were encountered:
No no no, I already know this AND this is not what I want. This is showing accessing to "comment" FROM "post" object. I want accessing to "post" FROM "comment" object.
Hi, I see that Nut::Row sharedpointers have fields related to their foreign keys. But they are always null. I want to be able to access those objects directly from the child table. Is this possible? Am I doing something wrong?
For example I have two tables, posts and comments:
"Comment" class has "Post" as foreign key. And "Post" class has "comments" as child table. Now, when I get a comment row with;
Nut::Row c = db.comments()->query()->first();
Here pointer "c" contains fields as postId and post. postId shows the related post's id. It is fine. BUT field "post" is always null. However it would be awesome if I could access to object post like this:
QString pn = c->post->postname(); // currently this line throws error, the app crashes, because c->post is nullptr.
I tried "join" but result is the same. post is always null.
Nut::Row c = db.comments()->query()->join()->first();
QString pn = c->post->postname(); // result is same as above.
Development platform:
OS: ubuntu 18.04
Qt creator 4.13.0, based on Qt 5.15.0
Compiler GCC 5.3.1
Nut commit hash: Commit 6ce50e2 by Jack Lilhammers, 07/07/2020 05:50 PM // this is the commit you used in OrmTest repo.
Serializer commit hash: Commit b0194da3 by Miklós Márton, 06/13/2020 12:00 AM // this is the commit you used in OrmTest repo.
Thank you in advance.
The text was updated successfully, but these errors were encountered: