commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons/dbutils/src/java/org/apache/commons/dbutils BeanProcessor.java
Date Thu, 02 Sep 2004 03:06:29 GMT
dgraham     2004/09/01 20:06:29

  Modified:    dbutils/src/java/org/apache/commons/dbutils
                        BeanProcessor.java
  Log:
  Removed unneeded cols parameter to createBean().
  
  Revision  Changes    Path
  1.6       +9 -17     jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/BeanProcessor.java
  
  Index: BeanProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/BeanProcessor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BeanProcessor.java	2 Sep 2004 02:51:40 -0000	1.5
  +++ BeanProcessor.java	2 Sep 2004 03:06:29 -0000	1.6
  @@ -115,12 +115,9 @@
           PropertyDescriptor[] props = this.propertyDescriptors(type);
   
           ResultSetMetaData rsmd = rs.getMetaData();
  -
           int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);
   
  -        int cols = rsmd.getColumnCount();
  -
  -        return this.createBean(rs, type, props, columnToProperty, cols);
  +        return this.createBean(rs, type, props, columnToProperty);
       }
       
       /**
  @@ -160,14 +157,10 @@
   
           PropertyDescriptor[] props = this.propertyDescriptors(type);
           ResultSetMetaData rsmd = rs.getMetaData();
  -        
           int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);
  -            
  -        int cols = rsmd.getColumnCount();
   
           do {
  -            results.add(this.createBean(rs, type, props, columnToProperty, cols));
  -
  +            results.add(this.createBean(rs, type, props, columnToProperty));
           } while (rs.next());
   
           return results;
  @@ -176,21 +169,20 @@
       /**
        * Creates a new object and initializes its fields from the ResultSet.
        *
  -     * @param rs The result set
  -     * @param type The bean type (the return type of the object)
  -     * @param props The property descriptors
  -     * @param columnToProperty The column indices in the result set
  -     * @param cols The number of columns
  +     * @param rs The result set.
  +     * @param type The bean type (the return type of the object).
  +     * @param props The property descriptors.
  +     * @param columnToProperty The column indices in the result set.
        * @return An initialized object.
  -     * @throws SQLException If a database error occurs
  +     * @throws SQLException If a database error occurs.
        */
       private Object createBean(ResultSet rs, Class type,
  -            PropertyDescriptor[] props, int[] columnToProperty, int cols)
  +            PropertyDescriptor[] props, int[] columnToProperty)
               throws SQLException {
   
           Object bean = this.newInstance(type);
   
  -        for (int i = 1; i <= cols; i++) {
  +        for (int i = 1; i < columnToProperty.length; i++) {
   
               if (columnToProperty[i] == PROPERTY_NOT_FOUND) {
                   continue;
  
  
  

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


Mime
View raw message