1 mysqlpp::Connection dbconnection; 2 dbconnection.connect("database", "server", "user", "passwd"); 3 4 mysqlpp::Query prepared_query = dbconnect.query("SELECT * FROM `my_table` "); 5 mysqlpp::StoreQueryResult r = prepared_query.store(); 6 7 int field = r.field_num("columntobefetched"); 8 9 for(mysqlpp::StoreQueryResult::iterator i=r.begin(); i!=r.end(); i++) 10 { 11 std::cout << i->at(field) << std::endl; 12 std::cout <<(*i)["columutobefetched"] << std::endl; //this will be slower 13 }