Oracle OCCI'选择计数(*)'结果提取

时间:2014-07-10 08:31:19

标签: c++ sql oracle occi

如何获得查询执行结果 - select count (*) from myTable? 代码是:

... 
oc::Statement* stmt = 
    m_cConnection->createStatement(select count (*) from myTable);

oc::ResultSet* res = stmt->executeQuery();
...

如何在res中获取行数的值?

1 个答案:

答案 0 :(得分:1)

只需写下

cout << res->getString(1) << endl;

cout << "\t... MySQL counts: " << res->getInt(1) << endl;