[ 
https://issues.apache.org/jira/browse/CSV-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15233278#comment-15233278
 ] 

Gary Gregory commented on CSV-123:
----------------------------------

Please see 
{{org.apache.commons.csv.CSVPrinterTest.testJdbcPrinterWithResultSetMetaData()}}:

{code:java}
            final CSVPrinter printer = 
CSVFormat.DEFAULT.withHeader(resultSet.getMetaData()).print(sw);
            printer.printRecords(resultSet);
            assertEquals("ID,NAME" + recordSeparator + "1,r1" + recordSeparator 
+ "2,r2" + recordSeparator,
                    sw.toString());
{code}

Is that good for you?

> Add possibility to use ResultSet header meta data as CSV header
> ---------------------------------------------------------------
>
>                 Key: CSV-123
>                 URL: https://issues.apache.org/jira/browse/CSV-123
>             Project: Commons CSV
>          Issue Type: New Feature
>          Components: Printer
>            Reporter: Benedikt Ritter
>             Fix For: Patch Needed, 1.x
>
>
> Add a possibility to use ResultSet meta data to add a header to the output in 
> {{CSVPrinter.printRecords(ResultSet)}} As suggested by Emmanuel Bourg during 
> the vote for CSV 1.0 RC1 (http://markmail.org/message/hudxi2fk3wez2rjz)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to