List:MySQL++« Previous MessageNext Message »
From:Joel Fielder Date:January 29 2010 8:55am
Subject:Re: How to do a large template query?
View as plain text  
Joel Fielder wrote:

Oops, I forgot the constructor in collect_books - amended below!
> class Book
> {
> public:
>    Book(const mysqlpp::Row& row)
>    : m_title(row["title"].data(),row["title"].length())
>    {
>    }
>
> private:
>    std::string m_title;
> };
>
> struct collect_books
> {
collect_books(std::vector<Book>& b)
: m_books(b)
{
}
>    void operator(const mysqlpp::Row& row)
>    {
>        m_books.push_back(Book(row));
>    }
std::vector<Book>& m_books;
> };
>
> mysqlpp::Connection connection(blah);
> mysqlpp::Query query = connection.query();
> query << "SELECT * FROM `books`";
>
> std::vector<Book> books;
> collect_books b = query.for_each(collect_books(books));
>

Thread
How to do a large template query?Adam Nielsen27 Jan
  • Re: How to do a large template query?Warren Young27 Jan
    • Re: How to do a large template query?Adam Nielsen28 Jan
      • Re: How to do a large template query?Joel Fielder28 Jan
        • Re: How to do a large template query?Warren Young28 Jan
          • Re: How to do a large template query?Adam Nielsen29 Jan
            • Re: How to do a large template query?Joel Fielder29 Jan
              • Re: How to do a large template query?Joel Fielder29 Jan
              • Re: How to do a large template query?Adam Nielsen1 Feb
            • Re: How to do a large template query?Warren Young29 Jan
              • Re: How to do a large template query?Adam Nielsen1 Feb
                • Re: How to do a large template query?Warren Young1 Feb
                  • Re: How to do a large template query?Warren Young7 Feb
          • Re: How to do a large template query?Warren Young7 Feb