Re: db_mysql: how to get column name?

2019-08-13 Thread luntik2012
@hiteshjasani @napalu thank you, it works. i just used it wrong

Re: db_mysql: how to get column name?

2019-08-03 Thread napalu
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:

Re: db_mysql: how to get column name?

2019-08-02 Thread hiteshjasani
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

Re: db_mysql: how to get column name?

2019-08-02 Thread luntik2012
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

Re: db_mysql: how to get column name?

2019-08-02 Thread hiteshjasani
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

Re: db_mysql: how to get column name?

2019-08-02 Thread luntik2012
[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"

db_mysql: how to get column name?

2019-08-02 Thread luntik2012
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.