List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:December 30 2010 10:38pm
Subject:Re: Return the number of fields in a 'vector<Row> myresultset;'.
View as plain text  
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.
Thread
Return the number of fields in a 'vector<Row> myresultset;'.Eric Sepich30 Dec
  • Re: Return the number of fields in a 'vector<Row> myresultset;'.Tomalak Geret'kal30 Dec
    • Re: Return the number of fields in a 'vector<Row> myresultset;'.Warren Young30 Dec
  • Re: Return the number of fields in a 'vector<Row> myresultset;'.Chris Morgan30 Dec
    • Re: Return the number of fields in a 'vector<Row> myresultset;'.Warren Young30 Dec
      • Re: Return the number of fields in a 'vector<Row> myresultset;'.Eric Sepich31 Dec