Getting query results as strings
For a general SQL query, I want to return a map of columns and values converted to strings. However, while cout prints out the value of row[index], I cannot find a way to make sure it is a string rather than some other type. Code like the following fails because I can't convert that row element to a string. How do I go about this?
while ((row = res.fetchOne())) {
for (unsigned index = 0; index < res.getColumnCount(); index++) {
cout << columns[index].getColumnName() << ": "
<< row[index] << endl;
string s1 = columns[index].getColumnName();
string s2 = string(row[index]); //THIS FAILS
stpRow->insert({ s1, s2 }); //add to current map
}
Subject
Views
Written By
Posted
Getting query results as strings
1158
April 19, 2023 07:28AM
287
April 19, 2023 01:31PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.