gpt4 book ai didi

c++ - Oracle OCCI 'select count(*)' 结果获取

转载 作者:行者123 更新时间:2023-11-28 06:47:41 24 4
gpt4 key购买 nike

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

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

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

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

最佳答案

随便写

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

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

关于c++ - Oracle OCCI 'select count(*)' 结果获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24671805/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com