c++ - Oracle OCCI - get column by name instead of index -


using oracle occi possible instead of supplying index column when requesting data query resultset, pass column name , data?

so instead of doing: (pseudocode)

std::string query = "select name customers;";  std::string myresult = oracle.getstring(1); // name column in query 

you'd this:

std::string myresult = oracle.getstring("name"); //column name string 

is there way this? have looked around, been unable find anything, besides perhaps going fetch table's metadata.

i read documentation.

it says resultset has method getcolumnlistmetadata(), produces vector of metadata.

most can use metadata::getstring find name of column.

and if can use std::map<string, int> map column names indices.

and nameindex mapping in place can implement getstring takes query result , column name arguments.

possibly has used particular database can better, seems needed take @ documentation.

cheers & hth.,


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -