dgraham     2003/10/22 16:33:25

  Modified:    dbutils/src/java/org/apache/commons/dbutils/handlers
                        MapHandler.java BeanListHandler.java
                        BeanHandler.java MapListHandler.java
                        ScalarHandler.java ArrayListHandler.java
                        ArrayHandler.java
               dbutils/src/java/org/apache/commons/dbutils
                        ResultSetHandler.java QueryRunner.java
  Log:
  Changed ResultSetHandler.handle() back to only accepting
  a ResultSet parameter.  The other parameters were no longer
  needed.
  
  Revision  Changes    Path
  1.2       +42 -44    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
  
  Index: MapHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/MapHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MapHandler.java   22 Oct 2003 23:13:43 -0000      1.1
  +++ MapHandler.java   22 Oct 2003 23:33:25 -0000      1.2
  @@ -77,47 +77,45 @@
    * @author David Graham
    */
   public class MapHandler implements ResultSetHandler {
  -    
  -    /**
  -     * The RowProcessor implementation to use when converting rows 
  -     * into Maps.
  -     */
  -    private RowProcessor convert = BasicRowProcessor.instance();
  -    
  -    /** 
  -     * Creates a new instance of MapHandler using a 
  -     * <code>BasicRowProcessor</code> for conversion.
  -     */
  -    public MapHandler() {
  -        super();
  -    }
  -    
  -    /** 
  -     * Creates a new instance of MapHandler.
  -     * 
  -     * @param convert The <code>RowProcessor</code> implementation 
  -     * to use when converting rows into Maps.
  -     */
  -    public MapHandler(RowProcessor convert) {
  -        super();
  -        this.convert = convert;
  -    }
   
  -    /**
  -     * Converts the first row in the <code>ResultSet</code> into a 
  -     * <code>Map</code>.
  -     * 
  -     * @return A <code>Map</code> with the values from the first row or 
  -     * <code>null</code> if there are no rows in the <code>ResultSet</code>. 
  -     * 
  -     * @throws SQLException
  -     * 
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  +     /**
  +      * The RowProcessor implementation to use when converting rows 
  +      * into Maps.
  +      */
  +     private RowProcessor convert = BasicRowProcessor.instance();
   
  -        return rs.next() ? this.convert.toMap(rs) : null;
  -    }
  +     /** 
  +      * Creates a new instance of MapHandler using a 
  +      * <code>BasicRowProcessor</code> for conversion.
  +      */
  +     public MapHandler() {
  +             super();
  +     }
  +
  +     /** 
  +      * Creates a new instance of MapHandler.
  +      * 
  +      * @param convert The <code>RowProcessor</code> implementation 
  +      * to use when converting rows into Maps.
  +      */
  +     public MapHandler(RowProcessor convert) {
  +             super();
  +             this.convert = convert;
  +     }
  +
  +     /**
  +      * Converts the first row in the <code>ResultSet</code> into a 
  +      * <code>Map</code>.
  +      * 
  +      * @return A <code>Map</code> with the values from the first row or 
  +      * <code>null</code> if there are no rows in the <code>ResultSet</code>. 
  +      * 
  +      * @throws SQLException
  +      * 
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +             return rs.next() ? this.convert.toMap(rs) : null;
  +     }
   
   }
  
  
  
  1.2       +50 -52    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
  
  Index: BeanListHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanListHandler.java      22 Oct 2003 23:13:43 -0000      1.1
  +++ BeanListHandler.java      22 Oct 2003 23:33:25 -0000      1.2
  @@ -79,54 +79,52 @@
    */
   public class BeanListHandler implements ResultSetHandler {
   
  -    /**
  -     * The Class of beans produced by this handler.
  -     */
  -    private Class type = null;
  -    
  -    /**
  -     * The RowProcessor implementation to use when converting rows 
  -     * into beans.
  -     */
  -    private RowProcessor convert = BasicRowProcessor.instance();
  +     /**
  +      * The Class of beans produced by this handler.
  +      */
  +     private Class type = null;
   
  -    /** 
  -     * Creates a new instance of BeanListHandler.
  -     * 
  -     * @param type The Class that objects returned from <code>handle()</code>
  -     * are created from.
  -     */
  -    public BeanListHandler(Class type) {
  -        this.type = type;
  -    }
  -    
  -    /** 
  -     * Creates a new instance of BeanListHandler.
  -     * 
  -     * @param type The Class that objects returned from <code>handle()</code>
  -     * are created from.
  -     * @param convert The <code>RowProcessor</code> implementation 
  -     * to use when converting rows into beans.
  -     */
  -    public BeanListHandler(Class type, RowProcessor convert) {
  -        this.type = type;
  -        this.convert = convert;
  -    }
  +     /**
  +      * The RowProcessor implementation to use when converting rows 
  +      * into beans.
  +      */
  +     private RowProcessor convert = BasicRowProcessor.instance();
   
  -    /**
  -     * Convert the <code>ResultSet</code> rows into a <code>List</code> of 
  -     * beans with the <code>Class</code> given in the constructor.
  -     * 
  -     * @return A <code>List</code> of beans (one for each row), never 
  -     * <code>null</code>.
  -     * 
  -     * @throws SQLException
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  -            
  -        return this.convert.toBeanList(rs, type);
  -    }
  +     /** 
  +      * Creates a new instance of BeanListHandler.
  +      * 
  +      * @param type The Class that objects returned from <code>handle()</code>
  +      * are created from.
  +      */
  +     public BeanListHandler(Class type) {
  +             this.type = type;
  +     }
  +
  +     /** 
  +      * Creates a new instance of BeanListHandler.
  +      * 
  +      * @param type The Class that objects returned from <code>handle()</code>
  +      * are created from.
  +      * @param convert The <code>RowProcessor</code> implementation 
  +      * to use when converting rows into beans.
  +      */
  +     public BeanListHandler(Class type, RowProcessor convert) {
  +             this.type = type;
  +             this.convert = convert;
  +     }
  +
  +     /**
  +      * Convert the <code>ResultSet</code> rows into a <code>List</code> of 
  +      * beans with the <code>Class</code> given in the constructor.
  +      * 
  +      * @return A <code>List</code> of beans (one for each row), never 
  +      * <code>null</code>.
  +      * 
  +      * @throws SQLException
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +             return this.convert.toBeanList(rs, type);
  +     }
   
   }
  
  
  
  1.2       +50 -52    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
  
  Index: BeanHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanHandler.java  22 Oct 2003 23:13:43 -0000      1.1
  +++ BeanHandler.java  22 Oct 2003 23:33:25 -0000      1.2
  @@ -78,54 +78,52 @@
    */
   public class BeanHandler implements ResultSetHandler {
   
  -    /**
  -     * The Class of beans produced by this handler.
  -     */
  -    private Class type = null;
  -    
  -    /**
  -     * The RowProcessor implementation to use when converting rows 
  -     * into beans.
  -     */
  -    private RowProcessor convert = BasicRowProcessor.instance();
  +     /**
  +      * The Class of beans produced by this handler.
  +      */
  +     private Class type = null;
   
  -    /** 
  -     * Creates a new instance of BeanHandler.
  -     * 
  -     * @param type The Class that objects returned from <code>handle()</code>
  -     * are created from.
  -     */
  -    public BeanHandler(Class type) {
  -        this.type = type;
  -    }
  -    
  -    /** 
  -     * Creates a new instance of BeanHandler.
  -     * 
  -     * @param type The Class that objects returned from <code>handle()</code>
  -     * are created from.
  -     * @param convert The <code>RowProcessor</code> implementation 
  -     * to use when converting rows into beans.
  -     */
  -    public BeanHandler(Class type, RowProcessor convert) {
  -        this.type = type;
  -        this.convert = convert;
  -    }
  +     /**
  +      * The RowProcessor implementation to use when converting rows 
  +      * into beans.
  +      */
  +     private RowProcessor convert = BasicRowProcessor.instance();
   
  -    /**
  -     * Convert the first row of the <code>ResultSet</code> into a bean with the
  -     * <code>Class</code> given in the constructor.
  -     * 
  -     * @return An initialized JavaBean or <code>null</code> if there were no 
  -     * rows in the <code>ResultSet</code>.
  -     * 
  -     * @throws SQLException
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  +     /** 
  +      * Creates a new instance of BeanHandler.
  +      * 
  +      * @param type The Class that objects returned from <code>handle()</code>
  +      * are created from.
  +      */
  +     public BeanHandler(Class type) {
  +             this.type = type;
  +     }
   
  -        return rs.next() ? this.convert.toBean(rs, this.type) : null;
  -    }
  +     /** 
  +      * Creates a new instance of BeanHandler.
  +      * 
  +      * @param type The Class that objects returned from <code>handle()</code>
  +      * are created from.
  +      * @param convert The <code>RowProcessor</code> implementation 
  +      * to use when converting rows into beans.
  +      */
  +     public BeanHandler(Class type, RowProcessor convert) {
  +             this.type = type;
  +             this.convert = convert;
  +     }
  +
  +     /**
  +      * Convert the first row of the <code>ResultSet</code> into a bean with the
  +      * <code>Class</code> given in the constructor.
  +      * 
  +      * @return An initialized JavaBean or <code>null</code> if there were no 
  +      * rows in the <code>ResultSet</code>.
  +      * 
  +      * @throws SQLException
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +             return rs.next() ? this.convert.toBean(rs, this.type) : null;
  +     }
   
   }
  
  
  
  1.2       +46 -47    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
  
  Index: MapListHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MapListHandler.java       22 Oct 2003 23:13:43 -0000      1.1
  +++ MapListHandler.java       22 Oct 2003 23:33:25 -0000      1.2
  @@ -80,51 +80,50 @@
    */
   public class MapListHandler implements ResultSetHandler {
   
  -    /**
  -     * The RowProcessor implementation to use when converting rows 
  -     * into Maps.
  -     */
  -    private RowProcessor convert = BasicRowProcessor.instance();
  -
  -    /** 
  -     * Creates a new instance of MapListHandler using a 
  -     * <code>BasicRowProcessor</code> for conversion.
  -     */
  -    public MapListHandler() {
  -        super();
  -    }
  -
  -    /** 
  -     * Creates a new instance of MapListHandler.
  -     * 
  -     * @param convert The <code>RowProcessor</code> implementation 
  -     * to use when converting rows into Maps.
  -     */
  -    public MapListHandler(RowProcessor convert) {
  -        super();
  -        this.convert = convert;
  -    }
  -
  -    /**
  -     * Converts the <code>ResultSet</code> rows into a <code>List</code> of 
  -     * <code>Map</code> objects.
  -     * 
  -     * @return A <code>List</code> of <code>Map</code>s, never null.  
  -     * 
  -     * @throws SQLException
  -     * 
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  -
  -        List results = new ArrayList();
  -
  -        while (rs.next()) {
  -            results.add(this.convert.toMap(rs));
  -        }
  +     /**
  +      * The RowProcessor implementation to use when converting rows 
  +      * into Maps.
  +      */
  +     private RowProcessor convert = BasicRowProcessor.instance();
  +
  +     /** 
  +      * Creates a new instance of MapListHandler using a 
  +      * <code>BasicRowProcessor</code> for conversion.
  +      */
  +     public MapListHandler() {
  +             super();
  +     }
  +
  +     /** 
  +      * Creates a new instance of MapListHandler.
  +      * 
  +      * @param convert The <code>RowProcessor</code> implementation 
  +      * to use when converting rows into Maps.
  +      */
  +     public MapListHandler(RowProcessor convert) {
  +             super();
  +             this.convert = convert;
  +     }
  +
  +     /**
  +      * Converts the <code>ResultSet</code> rows into a <code>List</code> of 
  +      * <code>Map</code> objects.
  +      * 
  +      * @return A <code>List</code> of <code>Map</code>s, never null.  
  +      * 
  +      * @throws SQLException
  +      * 
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +
  +             List results = new ArrayList();
  +
  +             while (rs.next()) {
  +                     results.add(this.convert.toMap(rs));
  +             }
   
  -        return results;
  -    }
  +             return results;
  +     }
   
   }
  
  
  
  1.2       +67 -68    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
  
  Index: ScalarHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ScalarHandler.java        22 Oct 2003 23:13:43 -0000      1.1
  +++ ScalarHandler.java        22 Oct 2003 23:33:25 -0000      1.2
  @@ -76,69 +76,68 @@
    */
   public class ScalarHandler implements ResultSetHandler {
   
  -    /**
  -     * The column number to retrieve.
  -     */
  -    private int columnIndex = 1;
  -
  -    /**
  -     * The column name to retrieve.  Either columnName or columnIndex
  -     * will be used but never both.
  -     */
  -    private String columnName = null;
  -
  -    /** 
  -     * Creates a new instance of ScalarHandler.  The first column will
  -     * be returned from <code>handle()</code>.
  -     */
  -    public ScalarHandler() {
  -        super();
  -    }
  -
  -    /** 
  -     * Creates a new instance of ScalarHandler.
  -     * 
  -     * @param columnIndex The index of the column to retrieve from the 
  -     * <code>ResultSet</code>.
  -     */
  -    public ScalarHandler(int columnIndex) {
  -        this.columnIndex = columnIndex;
  -    }
  -
  -    /** 
  -     * Creates a new instance of ScalarHandler.
  -     * 
  -     * @param columnName The name of the column to retrieve from the 
  -     * <code>ResultSet</code>.
  -     */
  -    public ScalarHandler(String columnName) {
  -        this.columnName = columnName;
  -    }
  -
  -    /**
  -     * Returns one <code>ResultSet</code> column as an object via the
  -     * <code>ResultSet.getObject()</code> method that performs type 
  -     * conversions.
  -     * 
  -     * @return The column or <code>null</code> if there are no rows in
  -     * the <code>ResultSet</code>.
  -     * 
  -     * @throws SQLException
  -     * 
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  -
  -        if (rs.next()) {
  -            if (this.columnName == null) {
  -                return rs.getObject(this.columnIndex);
  -            } else {
  -                return rs.getObject(this.columnName);
  -            }
  -            
  -        } else {
  -            return null;
  -        }
  -    }
  +     /**
  +      * The column number to retrieve.
  +      */
  +     private int columnIndex = 1;
  +
  +     /**
  +      * The column name to retrieve.  Either columnName or columnIndex
  +      * will be used but never both.
  +      */
  +     private String columnName = null;
  +
  +     /** 
  +      * Creates a new instance of ScalarHandler.  The first column will
  +      * be returned from <code>handle()</code>.
  +      */
  +     public ScalarHandler() {
  +             super();
  +     }
  +
  +     /** 
  +      * Creates a new instance of ScalarHandler.
  +      * 
  +      * @param columnIndex The index of the column to retrieve from the 
  +      * <code>ResultSet</code>.
  +      */
  +     public ScalarHandler(int columnIndex) {
  +             this.columnIndex = columnIndex;
  +     }
  +
  +     /** 
  +      * Creates a new instance of ScalarHandler.
  +      * 
  +      * @param columnName The name of the column to retrieve from the 
  +      * <code>ResultSet</code>.
  +      */
  +     public ScalarHandler(String columnName) {
  +             this.columnName = columnName;
  +     }
  +
  +     /**
  +      * Returns one <code>ResultSet</code> column as an object via the
  +      * <code>ResultSet.getObject()</code> method that performs type 
  +      * conversions.
  +      * 
  +      * @return The column or <code>null</code> if there are no rows in
  +      * the <code>ResultSet</code>.
  +      * 
  +      * @throws SQLException
  +      * 
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +
  +             if (rs.next()) {
  +                     if (this.columnName == null) {
  +                             return rs.getObject(this.columnIndex);
  +                     } else {
  +                             return rs.getObject(this.columnName);
  +                     }
  +
  +             } else {
  +                     return null;
  +             }
  +     }
   }
  
  
  
  1.2       +47 -48    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
  
  Index: ArrayListHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArrayListHandler.java     22 Oct 2003 23:13:43 -0000      1.1
  +++ ArrayListHandler.java     22 Oct 2003 23:33:25 -0000      1.2
  @@ -81,52 +81,51 @@
    */
   public class ArrayListHandler implements ResultSetHandler {
   
  -    /**
  -     * The RowProcessor implementation to use when converting rows 
  -     * into Object[]s.
  -     */
  -    private RowProcessor convert = BasicRowProcessor.instance();
  -
  -    /** 
  -     * Creates a new instance of ArrayListHandler using a 
  -     * <code>BasicRowProcessor</code> for conversions.
  -     */
  -    public ArrayListHandler() {
  -        super();
  -    }
  -
  -    /** 
  -     * Creates a new instance of ArrayListHandler.
  -     * 
  -     * @param convert The <code>RowProcessor</code> implementation 
  -     * to use when converting rows into Object[]s.
  -     */
  -    public ArrayListHandler(RowProcessor convert) {
  -        super();
  -        this.convert = convert;
  -    }
  -
  -    /**
  -     * Convert each row's columns into an <code>Object[]</code> and store them 
  -     * in a <code>List</code> in the same order they are returned from the
  -     * <code>ResultSet.next()</code> method. 
  -     * 
  -     * @return A <code>List</code> of <code>Object[]</code>s, never 
  -     * <code>null</code>.
  -     * 
  -     * @throws SQLException
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  -
  -        List result = new ArrayList();
  -
  -        while (rs.next()) {
  -            result.add(this.convert.toArray(rs));
  -        }
  +     /**
  +      * The RowProcessor implementation to use when converting rows 
  +      * into Object[]s.
  +      */
  +     private RowProcessor convert = BasicRowProcessor.instance();
  +
  +     /** 
  +      * Creates a new instance of ArrayListHandler using a 
  +      * <code>BasicRowProcessor</code> for conversions.
  +      */
  +     public ArrayListHandler() {
  +             super();
  +     }
  +
  +     /** 
  +      * Creates a new instance of ArrayListHandler.
  +      * 
  +      * @param convert The <code>RowProcessor</code> implementation 
  +      * to use when converting rows into Object[]s.
  +      */
  +     public ArrayListHandler(RowProcessor convert) {
  +             super();
  +             this.convert = convert;
  +     }
  +
  +     /**
  +      * Convert each row's columns into an <code>Object[]</code> and store them 
  +      * in a <code>List</code> in the same order they are returned from the
  +      * <code>ResultSet.next()</code> method. 
  +      * 
  +      * @return A <code>List</code> of <code>Object[]</code>s, never 
  +      * <code>null</code>.
  +      * 
  +      * @throws SQLException
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +
  +             List result = new ArrayList();
  +
  +             while (rs.next()) {
  +                     result.add(this.convert.toArray(rs));
  +             }
   
  -        return result;
  -    }
  +             return result;
  +     }
   
   }
  
  
  
  1.2       +39 -41    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
  
  Index: ArrayHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArrayHandler.java 22 Oct 2003 23:13:43 -0000      1.1
  +++ ArrayHandler.java 22 Oct 2003 23:33:25 -0000      1.2
  @@ -79,44 +79,42 @@
    */
   public class ArrayHandler implements ResultSetHandler {
   
  -    /**
  -     * The RowProcessor implementation to use when converting rows 
  -     * into arrays.
  -     */
  -    private RowProcessor convert = BasicRowProcessor.instance();
  -    
  -    /** 
  -     * Creates a new instance of ArrayHandler using a 
  -     * <code>BasicRowProcessor</code> for conversion.
  -     */
  -    public ArrayHandler() {
  -        super();
  -    }
  -    
  -    /** 
  -     * Creates a new instance of ArrayHandler.
  -     * 
  -     * @param convert The <code>RowProcessor</code> implementation 
  -     * to use when converting rows into arrays.
  -     */
  -    public ArrayHandler(RowProcessor convert) {
  -        super();
  -        this.convert = convert;
  -    }
  +     /**
  +      * The RowProcessor implementation to use when converting rows 
  +      * into arrays.
  +      */
  +     private RowProcessor convert = BasicRowProcessor.instance();
   
  -    /**
  -     * Places the column values from the first row in an <code>Object[]</code>.
  -     * 
  -     * @return An Object[] or <code>null</code> if there are no rows in the
  -     * <code>ResultSet</code>.
  -     * 
  -     * @throws SQLException
  -     * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet, 
java.lang.Object[], java.lang.Object)
  -     */
  -    public Object handle(ResultSet rs, Object[] params, Object userObject)
  -        throws SQLException {
  +     /** 
  +      * Creates a new instance of ArrayHandler using a 
  +      * <code>BasicRowProcessor</code> for conversion.
  +      */
  +     public ArrayHandler() {
  +             super();
  +     }
   
  -        return rs.next() ? this.convert.toArray(rs) : null;
  -    }
  +     /** 
  +      * Creates a new instance of ArrayHandler.
  +      * 
  +      * @param convert The <code>RowProcessor</code> implementation 
  +      * to use when converting rows into arrays.
  +      */
  +     public ArrayHandler(RowProcessor convert) {
  +             super();
  +             this.convert = convert;
  +     }
  +
  +     /**
  +      * Places the column values from the first row in an <code>Object[]</code>.
  +      * 
  +      * @return An Object[] or <code>null</code> if there are no rows in the
  +      * <code>ResultSet</code>.
  +      * 
  +      * @throws SQLException
  +      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
  +      */
  +     public Object handle(ResultSet rs) throws SQLException {
  +             return rs.next() ? this.convert.toArray(rs) : null;
  +     }
   
   }
  
  
  
  1.6       +18 -14    
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ResultSetHandler.java
  
  Index: ResultSetHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ResultSetHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ResultSetHandler.java     16 Oct 2003 03:25:46 -0000      1.5
  +++ ResultSetHandler.java     22 Oct 2003 23:33:25 -0000      1.6
  @@ -66,20 +66,24 @@
   
   /**
    * Implementations of this interface convert ResultSets into other objects.
  + *
    * @author Juozas Baliuka
  + * @author David Graham
    */
   public interface ResultSetHandler {
   
  -    /**
  -     * Turn the <code>ResultSet</code> into an Object.
  -     * @param rs
  -     * @param params
  -     * @param userObject
  -     * @return An Object initialized with <code>ResultSet</code> data or 
  -     * <code>null</code> if the <code>ResultSet</code> contained 0 rows.
  -     * @throws SQLException
  -     */
  -    public Object handle(ResultSet rs, Object params[], Object userObject)
  -        throws SQLException;
  +     /**
  +      * Turn the <code>ResultSet</code> into an Object.
  +      * 
  +      * @param rs The <code>ResultSet</code> to handle.  It has not been touched
  +      * before being passed to this method.
  +      * 
  +      * @return An Object initialized with <code>ResultSet</code> data. It is
  +      * legal for implementations to return <code>null</code> if the 
  +      * <code>ResultSet</code> contained 0 rows.
  +      * 
  +      * @throws SQLException
  +      */
  +     public Object handle(ResultSet rs) throws SQLException;
   
   }
  
  
  
  1.9       +4 -4      
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/QueryRunner.java
  
  Index: QueryRunner.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/QueryRunner.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- QueryRunner.java  22 Oct 2003 23:25:01 -0000      1.8
  +++ QueryRunner.java  22 Oct 2003 23:33:25 -0000      1.9
  @@ -188,7 +188,7 @@
   
                        rs = this.wrap(stmt.executeQuery());
   
  -                     result = rsh.handle(rs, params, null);
  +                     result = rsh.handle(rs);
   
                } catch (SQLException e) {
                        this.rethrow(e, sql, params);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to