Is there a way to get the column labels while running system.db.runNamedQuery?

Say I want to query against an entire table, and get some number of rows back. system.db.runNamedQuery returns only the resulting values, without any information about the columns. Is there an equivalent method to do this that would return the header of the table? Or do I have to go through the rigamarole of defining the column ordering in the query instead of being able to use something like SELECT * FROM table WHERE :parameter = :value LIMIT 1;?

If I wanted to run something like SELECT pg_get_result_column_names('your_query_name_or_statement');, where would I do it?

Named queries return datasets. Which have methods to .getColumnNames() and to .getColumnTypes(), which, thanks to jython, can be abbreviated NetBeans style as .columnNames and .columnTypes, respectively.

3 Likes

Perfect, thank you Phil.