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/06/04 02:21:38 UTC

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

Author: wspeirs
Date: Tue Jun  4 00:21:37 2013
New Revision: 1489244

URL: http://svn.apache.org/r1489244
Log:
Minor edits to prep for 1.6-RC1

Modified:
    commons/proper/dbutils/trunk/NOTICE.txt
    commons/proper/dbutils/trunk/doap_dbutils.rdf
    commons/proper/dbutils/trunk/src/changes/changes.xml
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/GenerousBeanProcessor.java
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java

Modified: commons/proper/dbutils/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/NOTICE.txt?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/NOTICE.txt (original)
+++ commons/proper/dbutils/trunk/NOTICE.txt Tue Jun  4 00:21:37 2013
@@ -1,5 +1,5 @@
 Apache Commons DbUtils
-Copyright 2002-2012 The Apache Software Foundation
+Copyright 2002-2013 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).

Modified: commons/proper/dbutils/trunk/doap_dbutils.rdf
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/doap_dbutils.rdf?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/doap_dbutils.rdf (original)
+++ commons/proper/dbutils/trunk/doap_dbutils.rdf Tue Jun  4 00:21:37 2013
@@ -37,6 +37,16 @@
       <!-- Dates for 1.1-1.3 taken from http://archive.apache.org/dist/commons/dbutils/binaries/ -->
       <Version>
         <name>commons-dbutils</name>
+        <created>2013-06-03</created>
+        <revision>1.6</revision>
+      </Version>
+      <Version>
+        <name>commons-dbutils</name>
+        <created>2012-07-20</created>
+        <revision>1.5</revision>
+      </Version>
+      <Version>
+        <name>commons-dbutils</name>
         <created>2011-10-23</created>
         <revision>1.4</revision>
       </Version>

Modified: commons/proper/dbutils/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/changes/changes.xml?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/changes/changes.xml (original)
+++ commons/proper/dbutils/trunk/src/changes/changes.xml Tue Jun  4 00:21:37 2013
@@ -43,7 +43,7 @@ The <action> type attribute can be add,u
     <title>Release Notes</title>
   </properties>
   <body>
-    <release version="1.6" date="201?-??-??" description="Bugfixes and addition of insert methods">
+    <release version="1.6" date="2013-06-03" description="Bugfixes and addition of insert methods">
       <action dev="sebb" type="update" issue="DBUTILS-85">
         In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)?
         Simplified code by using instanceof.

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java Tue Jun  4 00:21:37 2013
@@ -149,11 +149,11 @@ public abstract class AbstractQueryRunne
      *             if a database access error occurs
      */
     protected PreparedStatement prepareStatement(Connection conn, String sql)
-    throws SQLException {
+            throws SQLException {
 
         return conn.prepareStatement(sql);
     }
-    
+
     /**
      * Factory method that creates and initializes a
      * <code>PreparedStatement</code> object for the given SQL.
@@ -171,13 +171,13 @@ public abstract class AbstractQueryRunne
      *            The SQL statement to prepare.
      * @param returnedKeys
      *            Flag indicating whether to return generated keys or not.
-     * 
+     *
      * @return An initialized <code>PreparedStatement</code>.
      * @throws SQLException
      *             if a database access error occurs
      */
     protected PreparedStatement prepareStatement(Connection conn, String sql, int returnedKeys)
-    throws SQLException {
+            throws SQLException {
 
         return conn.prepareStatement(sql, returnedKeys);
     }
@@ -198,7 +198,7 @@ public abstract class AbstractQueryRunne
         if (this.getDataSource() == null) {
             throw new SQLException(
                     "QueryRunner requires a DataSource to be "
-                    + "invoked in this way, or a Connection should be passed in");
+                            + "invoked in this way, or a Connection should be passed in");
         }
         return this.getDataSource().getConnection();
     }
@@ -216,7 +216,7 @@ public abstract class AbstractQueryRunne
      *             if a database access error occurs
      */
     public void fillStatement(PreparedStatement stmt, Object... params)
-    throws SQLException {
+            throws SQLException {
 
         // check the parameter count, if we can
         ParameterMetaData pmd = null;
@@ -323,7 +323,7 @@ public abstract class AbstractQueryRunne
         PropertyDescriptor[] descriptors;
         try {
             descriptors = Introspector.getBeanInfo(bean.getClass())
-            .getPropertyDescriptors();
+                    .getPropertyDescriptors();
         } catch (IntrospectionException e) {
             throw new RuntimeException("Couldn't introspect bean "
                     + bean.getClass().toString(), e);
@@ -370,7 +370,7 @@ public abstract class AbstractQueryRunne
      *             if a database access error occurs
      */
     protected void rethrow(SQLException cause, String sql, Object... params)
-    throws SQLException {
+            throws SQLException {
 
         String causeMessage = cause.getMessage();
         if (causeMessage == null) {

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java Tue Jun  4 00:21:37 2013
@@ -286,7 +286,7 @@ public class AsyncQueryRunner extends Ab
      * @throws SQLException if a database access error occurs
      */
     public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params)
-        throws SQLException {
+            throws SQLException {
         return executorService.submit(new Callable<T>() {
 
             @Override
@@ -619,7 +619,7 @@ public class AsyncQueryRunner extends Ab
 
     /**
      * {@link QueryRunner#insertBatch(String, ResultSetHandler, Object[][])} asynchronously.
-     * 
+     *
      * @see QueryRunner#insertBatch(String, ResultSetHandler, Object[][])
      * @since 1.6
      */
@@ -632,10 +632,10 @@ public class AsyncQueryRunner extends Ab
             }
         });
     }
-    
+
     /**
      * {@link QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])} asynchronously.
-     * 
+     *
      * @see QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])
      * @since 1.6
      */
@@ -648,5 +648,5 @@ public class AsyncQueryRunner extends Ab
             }
         });
     }
-    
+
 }

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/GenerousBeanProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/GenerousBeanProcessor.java?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/GenerousBeanProcessor.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/GenerousBeanProcessor.java Tue Jun  4 00:21:37 2013
@@ -28,17 +28,17 @@ import java.util.Arrays;
  * columns to Java Bean properties.
  */
 public class GenerousBeanProcessor extends BeanProcessor {
-    
+
     /**
      * Default constructor.
      */
     public GenerousBeanProcessor() {
         super();
     }
-    
+
     @Override
     protected int[] mapColumnsToProperties(final ResultSetMetaData rsmd,
-                                           final PropertyDescriptor[] props) throws SQLException {
+            final PropertyDescriptor[] props) throws SQLException {
 
         final int cols = rsmd.getColumnCount();
         final int[] columnToProperty = new int[cols + 1];
@@ -46,19 +46,19 @@ public class GenerousBeanProcessor exten
 
         for (int col = 1; col <= cols; col++) {
             String columnName = rsmd.getColumnLabel(col);
-            
+
             if (null == columnName || 0 == columnName.length()) {
                 columnName = rsmd.getColumnName(col);
             }
-            
+
             final String generousColumnName = columnName.replace("_","");
 
             for (int i = 0; i < props.length; i++) {
                 final String propName = props[i].getName();
-                
+
                 // see if either the column name, or the generous one matches
                 if (columnName.equalsIgnoreCase(propName) ||
-                    generousColumnName.equalsIgnoreCase(propName)) {
+                        generousColumnName.equalsIgnoreCase(propName)) {
                     columnToProperty[col] = i;
                     break;
                 }
@@ -67,5 +67,5 @@ public class GenerousBeanProcessor exten
 
         return columnToProperty;
     }
-    
+
 }

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java?rev=1489244&r1=1489243&r2=1489244&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java Tue Jun  4 00:21:37 2013
@@ -194,7 +194,7 @@ public class QueryRunner extends Abstrac
      */
     @Deprecated
     public <T> T query(Connection conn, String sql, Object[] params, ResultSetHandler<T> rsh) throws SQLException {
-                return this.<T>query(conn, false, sql, rsh, params);
+        return this.<T>query(conn, false, sql, rsh, params);
     }
 
     /**
@@ -650,7 +650,7 @@ public class QueryRunner extends Abstrac
     public <T> T insertBatch(Connection conn, String sql, ResultSetHandler<T> rsh, Object[][] params) throws SQLException {
         return insertBatch(conn, false, sql, rsh, params);
     }
-    
+
     /**
      * Executes the given batch of INSERT SQL statements.
      * @param conn The connection to use for the query call.
@@ -664,46 +664,46 @@ public class QueryRunner extends Abstrac
      * @since 1.6
      */
     private <T> T insertBatch(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object[][] params) throws SQLException {
-       if (conn == null) {
-          throw new SQLException("Null connection");
-       }
-
-      if (sql == null) {
-          if (closeConn) {
-              close(conn);
-          }
-          throw new SQLException("Null SQL statement");
-      }
-
-      if (params == null) {
-          if (closeConn) {
-              close(conn);
-          }
-          throw new SQLException("Null parameters. If parameters aren't need, pass an empty array.");
-      }
-
-      PreparedStatement stmt = null;
-      T generatedKeys = null;
-      try {
-          stmt = this.prepareStatement(conn, sql, Statement.RETURN_GENERATED_KEYS);
-
-          for (int i = 0; i < params.length; i++) {
-              this.fillStatement(stmt, params[i]);
-              stmt.addBatch();
-          }
-          stmt.executeBatch();
-          ResultSet rs = stmt.getGeneratedKeys();
-          generatedKeys = rsh.handle(rs);
-
-      } catch (SQLException e) {
-          this.rethrow(e, sql, (Object[])params);
-      } finally {
-          close(stmt);
-          if (closeConn) {
-              close(conn);
-          }
-      }
+        if (conn == null) {
+            throw new SQLException("Null connection");
+        }
+
+        if (sql == null) {
+            if (closeConn) {
+                close(conn);
+            }
+            throw new SQLException("Null SQL statement");
+        }
+
+        if (params == null) {
+            if (closeConn) {
+                close(conn);
+            }
+            throw new SQLException("Null parameters. If parameters aren't need, pass an empty array.");
+        }
+
+        PreparedStatement stmt = null;
+        T generatedKeys = null;
+        try {
+            stmt = this.prepareStatement(conn, sql, Statement.RETURN_GENERATED_KEYS);
+
+            for (int i = 0; i < params.length; i++) {
+                this.fillStatement(stmt, params[i]);
+                stmt.addBatch();
+            }
+            stmt.executeBatch();
+            ResultSet rs = stmt.getGeneratedKeys();
+            generatedKeys = rsh.handle(rs);
+
+        } catch (SQLException e) {
+            this.rethrow(e, sql, (Object[])params);
+        } finally {
+            close(stmt);
+            if (closeConn) {
+                close(conn);
+            }
+        }
 
-      return generatedKeys;
+        return generatedKeys;
     }
 }