Mysql++

 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 }

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。