@hiteshjasani @napalu thank you, it works. i just used it wrong
There is an overload to instantRows which takes a var seq[DbColumn] as in
iterator instantRows*(db: DbConn; columns: var DbColumns; query: SqlQuery;
args: varargs[string, `$`]): InstantRow =
Run
So you should be able to do something like:
Your question was unclear.
I would take a look at the code for [instantRows
iterator](https://github.com/nim-lang/Nim/blob/master/lib/impure/db_mysql.nim#L187)
and do something similar with the addition of calling
[fetch_fields](https://nim-lang.org/docs/mysql.html#fetch_fields%2CPRES) to get
as I said, I cannot use query like this, because it is not table, it's
dynamically generated pivot table, to column names are generated dynamically,
like this
If you know the table name being used in the stored procedure, then you can
query the information_schema to get column names.
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'foo' AND TABLE_NAME ='bar';
Run
[https://nim-lang.org/docs/db_mysql.html#instantRows.i%2CDbConn%2Cseq%5BDbColumn%5D%2CSqlQuery%2Cvarargs%5Bstring%2C%5D](https://nim-lang.org/docs/db_mysql.html#instantRows.i%2CDbConn%2Cseq%5BDbColumn%5D%2CSqlQuery%2Cvarargs%5Bstring%2C%5D)
const q = sql"select * from mytable"
query:
call myProc();
Run
How to get column names from result?
There are dynamically generated column names inside this proc, so I cannot just
query db to return me column names.