2014-07-10 46 views
0

如何才能實現查詢執行結果 - select count (*) from myTable? 的代碼是:Oracle OCCI'選擇計數(*)'結果提取

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

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

我怎樣才能獲得行計數的res價值?

+0

這感覺就像是你應該能夠從他們的文檔弄清楚...你嘗試一些具體的和有問題? (此外,您可能希望在「s」中使用該查詢)。 – BoBTFish

+0

在源代碼中您的選擇查詢的周圍有引號嗎? –

+0

Found?! - res-> next(); int nCount = res-> getInt(1); – idanuda

回答

1

只要寫

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

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