i'm writing program in c++ using sqlcli for connecting to DB2 database. I want to execute queries from user input but i don't know how to get metadata for given query.

I input some select and execute it using SQLExecDirect and i need to find out names of columns to bind then. If select contains explicitely named columns i could maybe parse select but what if it's some query in form select * from aaa. Do I need to first call DESCRIBE TABLE command to obtain that metadata?

Is there some API for doing this?