You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/11/09 19:52:18 UTC

cvs commit: jakarta-commons/dbutils/src/java/org/apache/commons/dbutils BasicRowProcessor.java

dgraham     2003/11/09 10:52:18

  Modified:    dbutils/src/java/org/apache/commons/dbutils
                        BasicRowProcessor.java
  Log:
  Minor variable renaming.
  
  Revision  Changes    Path
  1.3       +15 -15    jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/BasicRowProcessor.java
  
  Index: BasicRowProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/BasicRowProcessor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicRowProcessor.java	9 Nov 2003 04:30:50 -0000	1.2
  +++ BasicRowProcessor.java	9 Nov 2003 18:52:18 -0000	1.3
  @@ -226,13 +226,13 @@
               return results;
           }
   
  -        PropertyDescriptor[] pd = this.propertyDescriptors(type);
  +        PropertyDescriptor[] props = this.propertyDescriptors(type);
           ResultSetMetaData rsmd = rs.getMetaData();
  -        int[] columnToProperty = this.mapColumnsToProperties(rsmd, pd);
  +        int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);
           int cols = rsmd.getColumnCount();
   
           do {
  -            results.add(this.createBean(rs, type, pd, columnToProperty, cols));
  +            results.add(this.createBean(rs, type, props, columnToProperty, cols));
   
           } while (rs.next());
   
  @@ -283,7 +283,8 @@
       /**
        * The positions in the returned array represent column numbers.  The values
        * stored at each position represent the index in the PropertyDescriptor[] 
  -     * for the bean property that matches the column name. 
  +     * for the bean property that matches the column name.  If no bean property
  +     * was found for a column, the position is set to PROPERTY_NOT_FOUND.
        * 
        * @return An int[] with column index to property index mappings.  The 0th 
        * element is meaningless as column indexing starts at 1.
  @@ -292,27 +293,27 @@
        */
       private int[] mapColumnsToProperties(
           ResultSetMetaData rsmd,
  -        PropertyDescriptor[] pd)
  +        PropertyDescriptor[] props)
           throws SQLException {
   
           int cols = rsmd.getColumnCount();
  -        int columnNameToIndex[] = new int[cols + 1];
  +        int columnToProperty[] = new int[cols + 1];
   
           for (int col = 1; col <= cols; col++) {
               String columnName = rsmd.getColumnName(col);
  -            for (int j = 0; j < pd.length; j++) {
  +            for (int i = 0; i < props.length; i++) {
   
  -                if (columnName.equalsIgnoreCase(pd[j].getName())) {
  -                    columnNameToIndex[col] = j;
  +                if (columnName.equalsIgnoreCase(props[i].getName())) {
  +                    columnToProperty[col] = i;
                       break;
   
                   } else {
  -                    columnNameToIndex[col] = PROPERTY_NOT_FOUND;
  +                    columnToProperty[col] = PROPERTY_NOT_FOUND;
                   }
               }
           }
   
  -        return columnNameToIndex;
  +        return columnToProperty;
       }
   
       /**
  @@ -496,7 +497,6 @@
           public Object remove(Object key) {
               return super.remove(key.toString().toLowerCase());
           }
  -
       }
   
   }
  
  
  

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