mysql retrieve field names as part of recordset -


i have application must avoid processing of mysql recordset returned select query, since interacting return in way results in expensive vba operations (which crashes ms excel large data returns). instead pass recordset directly cell range. requires recordset formatted , sorted data server.

i select query return recordset, first row of list of fields. find myself doing this

(select 'ticker', 'name', 'revenue', 'eps') union (select ticker, name, revenue, eps, table ticker in ('blk','dov','esl','csco','fb','ame','axp','bac','beav','el','mmm','ibm')) order  field(ticker, 'ticker','blk','dov','esl','csco','fb','ame','axp','bac','beav','el','mmm','ibm') 

which feels little bit ridiculous. there no mysql built-in function return field names record?

you can columns table so:

show columns mytable mydb; 

show columns displays following values each table column:

field indicates column name.

type indicates column data type.

collation indicates collation nonbinary string columns, or null other columns. value displayed if use full keyword.

the null field contains yes if null values can stored in column. if not, column contains no of mysql 5.0.3, , '' before that.

https://dev.mysql.com/doc/refman/5.0/en/show-columns.html

there ways of formatting application layer


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -