Hey,

Instead of a tuple you can also use for example your own class/struct, for
which you specialize Wt::Dbo::query_result_traits. You need to specialize
at least two methods. You will need to specialize a few more if you want to
use the Query inside a QueryModel.

struct Foo {
  int a;
  std::string b;
};

namespace Wt {
   namespace Dbo {

template<>
struct query_result_traits<Foo> {
  static void getFields(Session& session, std::vector<std::string> *aliases,
 std::vector<FieldInfo>& result) {
    query_result_traits<int>::getFields(session, aliases, result);
    query_result_traits<std::string>::getFields(session, aliases, result);
  }

  static Foo load(Session& session, SqlStatement& statement, int& column) {
    Foo result;
    result.a = query_result_traits<int>::load(session, statement, column);
    result.b = query_result_traits<std::string>::load(session, statement,
column);
    return result;
  }
};

   }
}


Regards,
koen


2014-05-28 2:16 GMT+02:00 Muhammad Nasser Al-Noimi <mnno...@gmail.com>:

>  Hi all,
>
> I want to generate query for aggregate data with more than 10 fields, When
> the number of fields were less than 10 I used boost::tuple for fields
> definition but boost::tuple cannot map more than 10 fields so how can I
> generate calculated query with more than 10 fields?
>
> Thanks a lot
>
>
> ------------------------------------------------------------------------------
> Time is money. Stop wasting it! Get your web API in 5 minutes.
> www.restlet.com/download
> http://p.sf.net/sfu/restlet
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to