You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ws...@apache.org on 2013/05/13 21:55:25 UTC

svn commit: r1482051 - in /commons/proper/dbutils/trunk/src: changes/changes.xml main/java/org/apache/commons/dbutils/BasicRowProcessor.java

Author: wspeirs
Date: Mon May 13 19:55:25 2013
New Revision: 1482051

URL: http://svn.apache.org/r1482051
Log:
Applied fix for DBUTILS-100 and added to changes.xml file

Modified:
    commons/proper/dbutils/trunk/src/changes/changes.xml
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java

Modified: commons/proper/dbutils/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/changes/changes.xml?rev=1482051&r1=1482050&r2=1482051&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/changes/changes.xml (original)
+++ commons/proper/dbutils/trunk/src/changes/changes.xml Mon May 13 19:55:25 2013
@@ -50,6 +50,9 @@ The <action> type attribute can be add,u
       <action dev="wspeirs" due-to="PB" type="add" issue="DBUTILS-107">
         Patch QueryLoader to also load from XML properties files
       </action>
+      <action dev="wspeirs" due-to="xiaofei.xu" type="fix" issue="DBUTILS-100">
+        Updated the use of getColumnName to try getColumnLabel first
+      </action>
       <action dev="simonetripodi" due-to="Moandji Ezana" type="add" issue="DBUTILS-98">
         Add missing JavaDoc to QueryRunner#insert
       </action>

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java?rev=1482051&r1=1482050&r2=1482051&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java Mon May 13 19:55:25 2013
@@ -156,7 +156,11 @@ public class BasicRowProcessor implement
         int cols = rsmd.getColumnCount();
 
         for (int i = 1; i <= cols; i++) {
-            result.put(rsmd.getColumnName(i), rs.getObject(i));
+            String columnName = rsmd.getColumnLabel(i);
+            if (null == columnName || 0 == columnName.length()) {
+              columnName = rsmd.getColumnName(i);
+            }
+            result.put(columnName, rs.getObject(i));
         }
 
         return result;