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 }

 

Mysql++

上一篇:使用instantclient_11_2 和PL/SQL Developer工具包连接oracle 11g远程数据库


下一篇:sqlite3命令行查看中文乱码问题解决