commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damjan Jovanovic <dam...@apache.org>
Subject [csv] CSVPrinter ResultSet quoting
Date Sat, 01 Nov 2014 04:33:14 GMT
Hi

Is there some reason CSVPrinter.printRecords(final ResultSet
resultSet) retrieves all fields from the ResultSet using
ResultSet.getString(), which makes QuoteMode.NON_NUMERIC quote
numbers?

This seems to work a lot better:

Index: src/main/java/org/apache/commons/csv/CSVPrinter.java
===================================================================
--- src/main/java/org/apache/commons/csv/CSVPrinter.java    (revision 1635890)
+++ src/main/java/org/apache/commons/csv/CSVPrinter.java    (working copy)
@@ -512,7 +512,7 @@
         }
         while (resultSet.next()) {
             for (int i = 1; i <= columnCount; i++) {
-                print(resultSet.getString(i));
+                print(resultSet.getObject(i));
             }
             println();
         }


Can I commit?

Thank you
Damjan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message