
On 18/07/2014 2:26 AM, Roland Bock wrote:
On 2014-07-17 15:34, Michael Shepanski wrote:
Shouldn't collections be mentioned on that page, too? I'm not sure I understand. Do you mean STL containers? Then no,
On 17/07/2014 10:48 PM, Roland Bock wrote: these are not mapped types (except for the special cases std::string and std::vector<uint8_t>). You can't have a table<std::list<float>>. No, sorry for the confusion, I meant the usage of collector classes.
Oh but they are mentioned! They are in the category of "user-defined class". Just as a std::tuple can be used to represent data in a table, and can also be put together _ad hoc_ by quince to deliver results of a join() or select(), the same can be said of user-defined classes (after they have been processed with QUINCE_MAP_CLASS).
Say I have two conditions, userWantsBlob and userWantsOther. I would want to have everything in one loop.
In sqlpp11 I could say something like:
auto query = dynamic_select(db, t.meta)...; if (userWantsBlob) query.add_column(t.blob); if (userWantsOther) query.add_column(t.other);
for (const auto& row : db(query)) { std::cout << t.meta << '\n'; if (userWantsBlob) std::cout << t.at("blob") << '\n'; if (userWantsOther) std::cout << t.at("other") << '\n'; };
How would you do that in quince?
Ah, no, quince's static typing forbids anything like that. If I wanted to provide it, that would be a matter of exposing type-unsafe code that I currently keep hidden. Cheers, --- Michael