From: Warren Young Date: December 30 2010 10:38pm Subject: Re: Return the number of fields in a 'vector myresultset;'. List-Archive: http://lists.mysql.com/plusplus/9159 Message-Id: <4D1D0A02.5000708@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 12/30/2010 1:52 PM, Chris Morgan wrote: > > If you want the number of columns in a particular mysqlpp::Row, you > need to use myslqpp::Row::size() That, or you can check with the result set object: mysqlpp::StoreQueryResult res = query.store(); cout << "Columns: " << res.num_fields() << endl; > mysqlpp::StoreQueryResult myresultset = query.store(); > > for (unsigned int i = 0; i< myresultset.num_rows(); i++) > { > std::cout<< "Row "<< i<< " Size: "<< myresultset[i].size()<< std::endl; > } No need to check each row. They'll all have the same number of columns. Each Row object refers back to the ResultBase derivative that created it for things like column information, so they can't be mismatched.