如何获得查询执行结果 - select count (*) from myTable
?
代码是:
...
oc::Statement* stmt =
m_cConnection->createStatement(select count (*) from myTable);
oc::ResultSet* res = stmt->executeQuery();
...
如何在res
中获取行数的值?
答案 0 :(得分:1)
只需写下
cout << res->getString(1) << endl;
或
cout << "\t... MySQL counts: " << res->getInt(1) << endl;