dgraham     2004/10/03 08:58:17

  Modified:    dbutils/src/java/org/apache/commons/dbutils QueryRunner.java
               dbutils/xdocs changes.xml
  Log:
  Changed QueryRunner to call getDataSource() internally instead of

  using instance variable directly.
  
  Revision  Changes    Path
  1.15      +6 -7      
jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/QueryRunner.java
  
  Index: QueryRunner.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/QueryRunner.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- QueryRunner.java  23 Aug 2004 01:51:50 -0000      1.14
  +++ QueryRunner.java  3 Oct 2004 15:58:17 -0000       1.15
  @@ -55,7 +55,7 @@
        */
       public QueryRunner(DataSource ds) {
           super();
  -        this.ds = ds;
  +        setDataSource(ds);
       }
       
       /**
  @@ -144,7 +144,10 @@
       }
   
       /**
  -     * Returns the <code>DataSource</code> this runner is using.
  +     * Returns the <code>DataSource</code> this runner is using.  
  +     * <code>QueryRunner</code> methods always call this method to get the
  +     * <code>DataSource</code> so subclasses can provide specialized
  +     * behavior.
        */
       public DataSource getDataSource() {
           return this.ds;
  @@ -183,7 +186,7 @@
        * @since DbUtils 1.1
        */
       protected Connection prepareConnection() throws SQLException {
  -        return this.ds.getConnection();
  +        return this.getDataSource().getConnection();
       }
   
       /**
  @@ -224,9 +227,7 @@
           try {
               stmt = this.prepareStatement(conn, sql);
               this.fillStatement(stmt, params);
  -
               rs = this.wrap(stmt.executeQuery());
  -
               result = rsh.handle(rs);
   
           } catch (SQLException e) {
  @@ -300,7 +301,6 @@
   
           try {
               return this.query(conn, sql, params, rsh);
  -
           } finally {
               close(conn);
           }
  @@ -415,7 +415,6 @@
           try {
               stmt = this.prepareStatement(conn, sql);
               this.fillStatement(stmt, params);
  -
               rows = stmt.executeUpdate();
   
           } catch (SQLException e) {
  
  
  
  1.6       +4 -0      jakarta-commons/dbutils/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbutils/xdocs/changes.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- changes.xml       3 Sep 2004 13:14:07 -0000       1.5
  +++ changes.xml       3 Oct 2004 15:58:17 -0000       1.6
  @@ -39,6 +39,10 @@
     <body>
   
       <release version="1.1-dev" date="in CVS">
  +      <action dev="dgraham" type="update">
  +        QueryRunner now calls getDataSource() internally any time it needs access
  +        to its DataSource object to allow subclasses to provide different behavior.
  +      </action>
         <action dev="dgraham" type="add">
           Added DbUtils.rollbackAndClose() and DbUtils.rollbackAndCloseQuietly().
         </action>
  
  
  

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

Reply via email to