How does session.query< std::tuple<ptr<A>, ptr<B> > > work?
Added by Albert Zenkoff 3 months ago
Hi! I am trying to get a join working and I cannot understand how to get this construct right. Your help will be appreciated.
If I use the construct as in the documentation:
using ReleasePart = std::tupleWt::Dbo::ptr
Wt::Dbo::collection col =
session_->query("SELECT r, p FROM releases r JOIN parts p ON p.id = r.part_id");
This fails to compile (template argument deduction/substitution failed).
If I try to list raw data like "long, string..." instead, it also does not compile.
If I try to use a reference to the tuple
Wt::Dbo::collectiondbo::ptr
session_->querydbo::ptr
it compiles but fails to map at run time
WResource: Uncaught exception from handleRequest (aborting request): Class St5tupleIJN2Wt3Dbo3ptrI7ReleaseEENS2_I4PartEEEE was not mapped.
which is, I suppose, to be expected.
What is the correct way to use this?
Replies (3)
RE: How does session.query< std::tuple<ptr<A>, ptr<B> > > work? - Added by Albert Zenkoff 3 months ago
Using 4.12.0 on Ubuntu with Postgres if it matters
Simple queries work fine.
RE: How does session.query< std::tuple<ptr<A>, ptr<B> > > work? - Added by Romain Mardulyn 28 days ago
Hi Albert,
Could you please resend the lines of code, as it seems some part of it are missing due to what I assume is an error you made in the formatting when writing your message.
In case you did not already know this, you can use the Preview tab in the message editor in order to see what your message will look like.
RE: How does session.query< std::tuple<ptr<A>, ptr<B> > > work? - Added by Albert Zenkoff 27 days ago
Sorry, already using a different framework since no help was offered here for months.