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
183
April 19, 2023 07:28AM
61
April 19, 2023 01:31PM
Sorry, only registered users may post in this forum.
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.