You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by th...@apache.org on 2020/01/05 02:36:48 UTC

[commons-dbutils] branch master updated (ff4b778 -> 0d9c321)

This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git.


    from ff4b778  Remove change record noting breaking change since that was reverted.
     new 5303749  DBUTILS-131 Optimization to use PreparedStatement only when params are available
     new b152c02  Updated download page in preparation for 1.8 release
     new 8c70e67  Updating release details for 1.8
     new 7ff17e5  Update notice to 2020
     new 0d9c321  Generate contributing, readme, jira, and mail-lists pages

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 NOTICE.txt                                         |   2 +-
 README.md                                          |  10 +-
 RELEASE-NOTES.txt                                  |  26 +--
 pom.xml                                            |   6 +-
 src/changes/changes.xml                            |   9 +-
 .../org/apache/commons/dbutils/QueryRunner.java    |  42 +++-
 src/site/site.xml                                  |   3 +-
 src/site/xdoc/download_dbutils.xml                 | 254 +++++++++++----------
 src/site/xdoc/issue-tracking.xml                   |   4 +-
 src/site/xdoc/mail-lists.xml                       |  30 +--
 .../commons/dbutils/AsyncQueryRunnerTest.java      | 121 +++++-----
 .../apache/commons/dbutils/QueryRunnerTest.java    | 171 ++++++++------
 12 files changed, 370 insertions(+), 308 deletions(-)


[commons-dbutils] 01/05: DBUTILS-131 Optimization to use PreparedStatement only when params are available

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git

commit 53037495f2f7cb1d46d42c26cbf1493a29f4a610
Author: Carl Hall <th...@apache.org>
AuthorDate: Sat Jan 4 15:27:43 2020 -0800

    DBUTILS-131 Optimization to use PreparedStatement only when params are available
---
 src/changes/changes.xml                            |   7 +-
 .../org/apache/commons/dbutils/QueryRunner.java    |  42 +++--
 .../commons/dbutils/AsyncQueryRunnerTest.java      | 121 ++++++++-------
 .../apache/commons/dbutils/QueryRunnerTest.java    | 171 ++++++++++++---------
 4 files changed, 199 insertions(+), 142 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 670e321..19f77fe 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,8 +45,8 @@ The <action> type attribute can be add,update,fix,remove.
   <body>
 
     <release version="2.0" date="2020-01-DD" description="New features and bug fixes.">
-      <action due-to="thecarlhall" type="update">
-        Java 1.7 now required. clirr, checkstyle, and spotbugs configured as part of default build.
+      <action dev="thecarlhall" type="fix" issue="DBUTILS-131" due-to="yairlenga">
+        Speedup query calls without parameters; Use PreparedStatement only when parameters are present.
       </action>
       <action dev="thecarlhall" type="fix">
         Always copy Date, Time, Timestamp on get and set in SqlNullCheckedResultSet.
@@ -69,6 +69,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="fix" issue="DBUTILS-139" due-to="Gary Gregory">
         Update Java requirement from version 6 to 7.
       </action>
+      <action due-to="thecarlhall" type="update">
+        clirr, checkstyle, and spotbugs configured as part of default build.
+      </action>
     </release>
     
     <release version="1.7" date="2017-07-20" description="Bug fixes and separate column &amp; property handlers using SPI">
diff --git a/src/main/java/org/apache/commons/dbutils/QueryRunner.java b/src/main/java/org/apache/commons/dbutils/QueryRunner.java
index dfe59ab..f76ce19 100644
--- a/src/main/java/org/apache/commons/dbutils/QueryRunner.java
+++ b/src/main/java/org/apache/commons/dbutils/QueryRunner.java
@@ -377,14 +377,20 @@ public class QueryRunner extends AbstractQueryRunner {
             throw new SQLException("Null ResultSetHandler");
         }
 
-        PreparedStatement stmt = null;
+        Statement stmt = null;
         ResultSet rs = null;
         T result = null;
 
         try {
-            stmt = this.prepareStatement(conn, sql);
-            this.fillStatement(stmt, params);
-            rs = this.wrap(stmt.executeQuery());
+            if (params != null && params.length > 0) {
+                PreparedStatement ps = this.prepareStatement(conn, sql);
+                stmt = ps;
+                this.fillStatement(ps, params);
+                rs = this.wrap(ps.executeQuery());
+            } else {
+                stmt = conn.createStatement();
+                rs = this.wrap(stmt.executeQuery(sql));
+            }
             result = rsh.handle(rs);
 
         } catch (final SQLException e) {
@@ -516,13 +522,19 @@ public class QueryRunner extends AbstractQueryRunner {
             throw new SQLException("Null SQL statement");
         }
 
-        PreparedStatement stmt = null;
+        Statement stmt = null;
         int rows = 0;
 
         try {
-            stmt = this.prepareStatement(conn, sql);
-            this.fillStatement(stmt, params);
-            rows = stmt.executeUpdate();
+            if (params != null && params.length > 0) {
+                PreparedStatement ps = this.prepareStatement(conn, sql);
+                stmt = ps;
+                this.fillStatement(ps, params);
+                rows = ps.executeUpdate();
+            } else {
+                stmt = conn.createStatement();
+                rows = stmt.executeUpdate(sql);
+            }
 
         } catch (final SQLException e) {
             this.rethrow(e, sql, params);
@@ -634,13 +646,19 @@ public class QueryRunner extends AbstractQueryRunner {
             throw new SQLException("Null ResultSetHandler");
         }
 
-        PreparedStatement stmt = null;
+        Statement stmt = null;
         T generatedKeys = null;
 
         try {
-            stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
-            this.fillStatement(stmt, params);
-            stmt.executeUpdate();
+            if (params != null && params.length > 0) {
+                PreparedStatement ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
+                stmt = ps;
+                this.fillStatement(ps, params);
+                ps.executeUpdate();
+            } else {
+                stmt = conn.createStatement();
+                stmt.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
+            }
             final ResultSet resultSet = stmt.getGeneratedKeys();
             generatedKeys = rsh.handle(resultSet);
         } catch (final SQLException e) {
diff --git a/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java b/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
index f900feb..44db6d2 100644
--- a/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
@@ -29,6 +29,7 @@ import java.sql.ParameterMetaData;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
@@ -49,7 +50,8 @@ public class AsyncQueryRunnerTest {
 
     @Mock DataSource dataSource;
     @Mock Connection conn;
-    @Mock PreparedStatement stmt;
+    @Mock PreparedStatement prepStmt;
+    @Mock Statement stmt;
     @Mock ParameterMetaData meta;
     @Mock ResultSet results;
 
@@ -58,10 +60,16 @@ public class AsyncQueryRunnerTest {
         MockitoAnnotations.initMocks(this);
 
         when(dataSource.getConnection()).thenReturn(conn);
-        when(conn.prepareStatement(any(String.class))).thenReturn(stmt);
-        when(stmt.getParameterMetaData()).thenReturn(meta);
+
+        when(conn.prepareStatement(any(String.class))).thenReturn(prepStmt);
+        when(prepStmt.getParameterMetaData()).thenReturn(meta);
+        when(prepStmt.getResultSet()).thenReturn(results);
+        when(prepStmt.executeQuery()).thenReturn(results);
+
+        when(conn.createStatement()).thenReturn(stmt);
         when(stmt.getResultSet()).thenReturn(results);
-        when(stmt.executeQuery()).thenReturn(results);
+        when(stmt.executeQuery(any(String.class))).thenReturn(results);
+
         when(results.next()).thenReturn(false);
 
          handler = new ArrayHandler();
@@ -77,9 +85,9 @@ public class AsyncQueryRunnerTest {
 
         future.get();
 
-        verify(stmt, times(2)).addBatch();
-        verify(stmt, times(1)).executeBatch();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).addBatch();
+        verify(prepStmt, times(1)).executeBatch();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we closed the connection
     }
 
@@ -89,9 +97,9 @@ public class AsyncQueryRunnerTest {
 
         future.get();
 
-        verify(stmt, times(2)).addBatch();
-        verify(stmt, times(1)).executeBatch();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).addBatch();
+        verify(prepStmt, times(1)).executeBatch();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
     }
 
@@ -138,9 +146,9 @@ public class AsyncQueryRunnerTest {
 
             future.get();
 
-            verify(stmt, times(2)).addBatch();
-            verify(stmt, times(1)).executeBatch();
-            verify(stmt, times(1)).close();    // make sure the statement is closed
+            verify(prepStmt, times(2)).addBatch();
+            verify(prepStmt, times(1)).executeBatch();
+            verify(prepStmt, times(1)).close();    // make sure the statement is closed
             verify(conn, times(1)).close();    // make sure the connection is closed
         } catch(final Exception e) {
             caught = true;
@@ -195,7 +203,7 @@ public class AsyncQueryRunnerTest {
     public void testAddBatchException() throws Exception {
         final String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
 
-        doThrow(new SQLException()).when(stmt).addBatch();
+        doThrow(new SQLException()).when(prepStmt).addBatch();
 
         callBatchWithException("select * from blah where ? = ?", params);
     }
@@ -204,7 +212,7 @@ public class AsyncQueryRunnerTest {
     public void testExecuteBatchException() throws Exception {
         final String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
 
-        doThrow(new SQLException()).when(stmt).executeBatch();
+        doThrow(new SQLException()).when(prepStmt).executeBatch();
 
         callBatchWithException("select * from blah where ? = ?", params);
     }
@@ -215,39 +223,43 @@ public class AsyncQueryRunnerTest {
     //
     private void callGoodQuery(final Connection conn) throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test").get();
+        String sql = "select * from blah where ? = ?";
+        runner.query(conn, sql, handler, "unit", "test").get();
 
-        verify(stmt, times(1)).executeQuery();
+        verify(prepStmt, times(1)).executeQuery();
         verify(results, times(1)).close();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we closed the connection
 
         // call the other variation of query
         when(meta.getParameterCount()).thenReturn(0);
-        runner.query(conn, "select * from blah", handler).get();
+        sql = "select * from blah";
+        runner.query(conn, sql, handler).get();
 
-        verify(stmt, times(2)).executeQuery();
+        verify(stmt, times(1)).executeQuery(sql);
         verify(results, times(2)).close();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we closed the connection
     }
 
     private void callGoodQuery() throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.query("select * from blah where ? = ?", handler, "unit", "test").get();
+        String sql = "select * from blah where ? = ?";
+        runner.query(sql, handler, "unit", "test").get();
 
-        verify(stmt, times(1)).executeQuery();
+        verify(prepStmt, times(1)).executeQuery();
         verify(results, times(1)).close();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
 
         // call the other variation of query
         when(meta.getParameterCount()).thenReturn(0);
-        runner.query("select * from blah", handler).get();
+        sql = "select * from blah";
+        runner.query(sql, handler).get();
 
-        verify(stmt, times(2)).executeQuery();
+        verify(stmt, times(1)).executeQuery(sql);
         verify(results, times(2)).close();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(2)).close();    // make sure we closed the connection
     }
 
@@ -278,9 +290,9 @@ public class AsyncQueryRunnerTest {
             when(meta.getParameterCount()).thenReturn(2);
             runner.query("select * from blah where ? = ?", handler, params).get();
 
-            verify(stmt, times(1)).executeQuery();
+            verify(prepStmt, times(1)).executeQuery();
             verify(results, times(1)).close();
-            verify(stmt, times(1)).close();    // make sure we closed the statement
+            verify(prepStmt, times(1)).close();    // make sure we closed the statement
             verify(conn, times(1)).close();    // make sure we closed the connection
         } catch(final Exception e) {
             caught = true;
@@ -293,7 +305,7 @@ public class AsyncQueryRunnerTest {
 
     @Test
     public void testNoParamsQuery() throws Exception {
-        callQueryWithException();
+        callGoodQuery();
     }
 
     @Test
@@ -330,7 +342,7 @@ public class AsyncQueryRunnerTest {
 
     @Test
     public void testExecuteQueryException() throws Exception {
-        doThrow(new SQLException()).when(stmt).executeQuery();
+        doThrow(new SQLException()).when(prepStmt).executeQuery();
 
         callQueryWithException(handler, "unit", "test");
     }
@@ -341,51 +353,56 @@ public class AsyncQueryRunnerTest {
     //
     private void callGoodUpdate(final Connection conn) throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.update(conn, "update blah set ? = ?", "unit", "test").get();
+        String sql = "update blah set ? = ?";
+        runner.update(conn, sql, "unit", "test").get();
 
-        verify(stmt, times(1)).executeUpdate();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).executeUpdate();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we closed the connection
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(0);
-        runner.update(conn, "update blah set unit = test").get();
+        sql = "update blah set unit = test";
+        runner.update(conn, sql).get();
 
-        verify(stmt, times(2)).executeUpdate();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).executeUpdate(sql);
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we closed the connection
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(1);
-        runner.update(conn, "update blah set unit = ?", "test").get();
+        sql = "update blah set unit = ?";
+        runner.update(conn, sql, "test").get();
 
-        verify(stmt, times(3)).executeUpdate();
-        verify(stmt, times(3)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).executeUpdate();
+        verify(prepStmt, times(2)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we closed the connection
     }
 
     private void callGoodUpdate() throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.update("update blah set ? = ?", "unit", "test").get();
+        String sql = "update blah set ? = ?";
+        runner.update(sql, "unit", "test").get();
 
-        verify(stmt, times(1)).executeUpdate();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).executeUpdate();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(0);
-        runner.update("update blah set unit = test").get();
+        sql = "update blah set unit = test";
+        runner.update(sql).get();
 
-        verify(stmt, times(2)).executeUpdate();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).executeUpdate(sql);
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(2)).close();    // make sure we closed the connection
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(1);
         runner.update("update blah set unit = ?", "test").get();
 
-        verify(stmt, times(3)).executeUpdate();
-        verify(stmt, times(3)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).executeUpdate();
+        verify(prepStmt, times(2)).close();    // make sure we closed the statement
         verify(conn, times(3)).close();    // make sure we closed the connection
     }
 
@@ -415,8 +432,8 @@ public class AsyncQueryRunnerTest {
             when(meta.getParameterCount()).thenReturn(2);
             runner.update("select * from blah where ? = ?", params).get();
 
-            verify(stmt, times(1)).executeUpdate();
-            verify(stmt, times(1)).close();    // make sure we closed the statement
+            verify(prepStmt, times(1)).executeUpdate();
+            verify(prepStmt, times(1)).close();    // make sure we closed the statement
             verify(conn, times(1)).close();    // make sure we closed the connection
         } catch(final Exception e) {
             caught = true;
@@ -429,7 +446,7 @@ public class AsyncQueryRunnerTest {
 
     @Test
     public void testNoParamsUpdate() throws Exception {
-        callUpdateWithException();
+        callGoodUpdate();
     }
 
     @Test
@@ -480,7 +497,7 @@ public class AsyncQueryRunnerTest {
 
     @Test
     public void testExecuteUpdateException() throws Exception {
-        doThrow(new SQLException()).when(stmt).executeUpdate();
+        doThrow(new SQLException()).when(prepStmt).executeUpdate();
 
         callUpdateWithException("unit", "test");
     }
diff --git a/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java b/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
index 727c2c9..2802c16 100644
--- a/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
@@ -17,9 +17,9 @@
 package org.apache.commons.dbutils;
 
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
@@ -46,6 +46,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -57,7 +58,8 @@ public class QueryRunnerTest {
 
     @Mock DataSource dataSource;
     @Mock Connection conn;
-    @Mock PreparedStatement stmt;
+    @Mock PreparedStatement prepStmt;
+    @Mock Statement stmt;
     @Mock CallableStatement call;
     @Mock ParameterMetaData meta;
     @Mock ResultSet results;
@@ -68,14 +70,21 @@ public class QueryRunnerTest {
         MockitoAnnotations.initMocks(this);    // init the mocks
 
         when(dataSource.getConnection()).thenReturn(conn);
-        when(conn.prepareStatement(any(String.class))).thenReturn(stmt);
-        when(stmt.getParameterMetaData()).thenReturn(meta);
+
+        when(conn.prepareStatement(any(String.class))).thenReturn(prepStmt);
+        when(prepStmt.getParameterMetaData()).thenReturn(meta);
+        when(prepStmt.getResultSet()).thenReturn(results);
+        when(prepStmt.executeQuery()).thenReturn(results);
+
+        when(conn.createStatement()).thenReturn(stmt);
         when(stmt.getResultSet()).thenReturn(results);
-        when(stmt.executeQuery()).thenReturn(results);
+        when(stmt.executeQuery(any(String.class))).thenReturn(results);
+
         when(conn.prepareCall(any(String.class))).thenReturn(call);
         when(call.getParameterMetaData()).thenReturn(meta);
         when(call.getResultSet()).thenReturn(results);
         when(call.getMoreResults()).thenReturn(false);
+
         when(results.next()).thenReturn(false);
 
          handler = new ArrayHandler();
@@ -90,9 +99,9 @@ public class QueryRunnerTest {
         when(meta.getParameterCount()).thenReturn(2);
         runner.batch(conn, "select * from blah where ? = ?", params);
 
-        verify(stmt, times(2)).addBatch();
-        verify(stmt, times(1)).executeBatch();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).addBatch();
+        verify(prepStmt, times(1)).executeBatch();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we do not close the connection, since QueryRunner.batch(Connection, String, Object[][]) does not close connections
     }
 
@@ -100,9 +109,9 @@ public class QueryRunnerTest {
         when(meta.getParameterCount()).thenReturn(2);
         runner.batch("select * from blah where ? = ?", params);
 
-        verify(stmt, times(2)).addBatch();
-        verify(stmt, times(1)).executeBatch();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).addBatch();
+        verify(prepStmt, times(1)).executeBatch();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
     }
 
@@ -145,9 +154,9 @@ public class QueryRunnerTest {
         try {
             runner.batch(sql, params);
 
-            verify(stmt, times(2)).addBatch();
-            verify(stmt, times(1)).executeBatch();
-            verify(stmt, times(1)).close();    // make sure the statement is closed
+            verify(prepStmt, times(2)).addBatch();
+            verify(prepStmt, times(1)).executeBatch();
+            verify(prepStmt, times(1)).close();    // make sure the statement is closed
             verify(conn, times(1)).close();    // make sure the connection is closed
         } catch(final SQLException e) {
             caught = true;
@@ -202,7 +211,7 @@ public class QueryRunnerTest {
     public void testAddBatchException() throws Exception {
         final String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
 
-        doThrow(new SQLException()).when(stmt).addBatch();
+        doThrow(new SQLException()).when(prepStmt).addBatch();
 
         callBatchWithException("select * from blah where ? = ?", params);
     }
@@ -211,7 +220,7 @@ public class QueryRunnerTest {
     public void testExecuteBatchException() throws Exception {
         final String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
 
-        doThrow(new SQLException()).when(stmt).executeBatch();
+        doThrow(new SQLException()).when(prepStmt).executeBatch();
 
         callBatchWithException("select * from blah where ? = ?", params);
     }
@@ -222,39 +231,43 @@ public class QueryRunnerTest {
     //
     private void callGoodQuery(final Connection conn) throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test");
+        String sql = "select * from blah where ? = ?";
+        runner.query(conn, sql, handler, "unit", "test");
 
-        verify(stmt, times(1)).executeQuery();
+        verify(prepStmt, times(1)).executeQuery();
         verify(results, times(1)).close();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we do not close the connection, since QueryRunner.query(Connection, String, ResultSetHandler<T>, Object...) does not close connections
 
         // call the other variation of query
         when(meta.getParameterCount()).thenReturn(0);
-        runner.query(conn, "select * from blah", handler);
+        sql = "select * from blah";
+        runner.query(conn, sql, handler);
 
-        verify(stmt, times(2)).executeQuery();
+        verify(stmt, times(1)).executeQuery(sql);
         verify(results, times(2)).close();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we do not close the connection, see above
     }
 
     private void callGoodQuery() throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.query("select * from blah where ? = ?", handler, "unit", "test");
+        String sql = "select * from blah where ? = ?";
+        runner.query(sql, handler, "unit", "test");
 
-        verify(stmt, times(1)).executeQuery();
+        verify(prepStmt, times(1)).executeQuery();
         verify(results, times(1)).close();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
 
         // call the other variation of query
         when(meta.getParameterCount()).thenReturn(0);
-        runner.query("select * from blah", handler);
+        sql = "select * from blah";
+        runner.query(sql, handler);
 
-        verify(stmt, times(2)).executeQuery();
+        verify(stmt, times(1)).executeQuery(sql);
         verify(results, times(2)).close();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(2)).close();    // make sure we closed the connection
     }
 
@@ -282,12 +295,13 @@ public class QueryRunnerTest {
 
         try {
             when(meta.getParameterCount()).thenReturn(2);
-            runner.query("select * from blah where ? = ?", handler, params);
+            String sql = "select * from blah where ? = ?";
+            runner.query(sql, handler, params);
 
-            verify(stmt, never()).close();    // make sure the statement is still open
-            verify(stmt, times(1)).executeQuery();
+            verify(prepStmt, never()).close();    // make sure the statement is still open
+            verify(prepStmt, times(1)).executeQuery();
+            verify(prepStmt, times(1)).close();    // make sure we closed the statement
             verify(results, times(1)).close();
-            verify(stmt, times(1)).close();    // make sure we closed the statement
             verify(conn, times(1)).close();    // make sure we closed the connection
         } catch(final SQLException e) {
             caught = true;
@@ -300,7 +314,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testNoParamsQuery() throws Exception {
-        callQueryWithException();
+        callGoodQuery();
     }
 
     @Test
@@ -337,7 +351,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testExecuteQueryException() throws Exception {
-        doThrow(new SQLException()).when(stmt).executeQuery();
+        doThrow(new SQLException()).when(prepStmt).executeQuery();
 
         callQueryWithException(handler, "unit", "test");
     }
@@ -350,49 +364,53 @@ public class QueryRunnerTest {
         when(meta.getParameterCount()).thenReturn(2);
         runner.update(conn, "update blah set ? = ?", "unit", "test");
 
-        verify(stmt, times(1)).executeUpdate();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).executeUpdate();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we do not close the connection, since QueryRunner.update(Connection, String, Object...) does not close connections
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(0);
-        runner.update(conn, "update blah set unit = test");
+        String sql = "update blah set unit = test";
+        runner.update(conn, sql);
 
-        verify(stmt, times(2)).executeUpdate();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).executeUpdate(sql);
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we do not close the connection, see above
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(1);
         runner.update(conn, "update blah set unit = ?", "test");
 
-        verify(stmt, times(3)).executeUpdate();
-        verify(stmt, times(3)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).executeUpdate();
+        verify(prepStmt, times(2)).close();    // make sure we closed the statement
         verify(conn, times(0)).close();    // make sure we do not close the connection, see above
     }
 
     private void callGoodUpdate() throws Exception {
         when(meta.getParameterCount()).thenReturn(2);
-        runner.update("update blah set ? = ?", "unit", "test");
+        String sql = "update blah set ? = ?";
+        runner.update(sql, "unit", "test");
 
-        verify(stmt, times(1)).executeUpdate();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).executeUpdate();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(0);
-        runner.update("update blah set unit = test");
+        sql = "update blah set unit = test";
+        runner.update(sql);
 
-        verify(stmt, times(2)).executeUpdate();
-        verify(stmt, times(2)).close();    // make sure we closed the statement
+        verify(stmt, times(1)).executeUpdate(sql);
+        verify(stmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(2)).close();    // make sure we closed the connection
 
         // call the other variation
         when(meta.getParameterCount()).thenReturn(1);
-        runner.update("update blah set unit = ?", "test");
+        sql = "update blah set unit = ?";
+        runner.update(sql, "test");
 
-        verify(stmt, times(3)).executeUpdate();
-        verify(stmt, times(3)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).executeUpdate();
+        verify(prepStmt, times(2)).close();    // make sure we closed the statement
         verify(conn, times(3)).close();    // make sure we closed the connection
     }
 
@@ -418,15 +436,15 @@ public class QueryRunnerTest {
         results = mock(ResultSet.class);
 
         when(meta.getParameterCount()).thenReturn(2);
-        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(stmt);
-        when(stmt.getGeneratedKeys()).thenReturn(results);
+        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(prepStmt);
+        when(prepStmt.getGeneratedKeys()).thenReturn(results);
         when(results.next()).thenReturn(true).thenReturn(false);
         when(results.getObject(1)).thenReturn(1L);
 
         final Long generatedKey = runner.insert("INSERT INTO blah(col1, col2) VALUES(?,?)", new ScalarHandler<Long>(), "unit", "test");
 
-        verify(stmt, times(1)).executeUpdate();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(1)).executeUpdate();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
 
         Assert.assertEquals(1L, generatedKey.longValue());
@@ -438,8 +456,8 @@ public class QueryRunnerTest {
         resultsMeta = mock(ResultSetMetaData.class);
 
         when(meta.getParameterCount()).thenReturn(2);
-        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(stmt);
-        when(stmt.getGeneratedKeys()).thenReturn(results);
+        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(prepStmt);
+        when(prepStmt.getGeneratedKeys()).thenReturn(results);
         when(results.next()).thenReturn(true).thenReturn(true).thenReturn(false);
         when(results.getMetaData()).thenReturn(resultsMeta);
         when(resultsMeta.getColumnCount()).thenReturn(1);
@@ -466,9 +484,9 @@ public class QueryRunnerTest {
 
         final List<Object> generatedKeys = runner.insertBatch("INSERT INTO blah(col1, col2) VALUES(?,?)", handler, params);
 
-        verify(stmt, times(2)).addBatch();
-        verify(stmt, times(1)).executeBatch();
-        verify(stmt, times(1)).close();    // make sure we closed the statement
+        verify(prepStmt, times(2)).addBatch();
+        verify(prepStmt, times(1)).executeBatch();
+        verify(prepStmt, times(1)).close();    // make sure we closed the statement
         verify(conn, times(1)).close();    // make sure we closed the connection
 
         Assert.assertEquals(2, generatedKeys.size());
@@ -480,10 +498,11 @@ public class QueryRunnerTest {
 
         try {
             when(meta.getParameterCount()).thenReturn(2);
-            runner.update("select * from blah where ? = ?", params);
+            String sql = "select * from blah where ? = ?";
+            runner.update(sql, params);
 
-            verify(stmt, times(1)).executeUpdate();
-            verify(stmt, times(1)).close();    // make sure we closed the statement
+            verify(prepStmt, times(1)).executeUpdate();
+            verify(prepStmt, times(1)).close();    // make sure we closed the statement
             verify(conn, times(1)).close();    // make sure we closed the connection
         } catch(final SQLException e) {
             caught = true;
@@ -496,7 +515,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testNoParamsUpdate() throws Exception {
-        callUpdateWithException();
+        callGoodUpdate();
     }
 
     @Test
@@ -526,7 +545,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testExecuteUpdateException() throws Exception {
-        doThrow(new SQLException()).when(stmt).executeUpdate();
+        doThrow(new SQLException()).when(prepStmt).executeUpdate();
 
         callUpdateWithException("unit", "test");
     }
@@ -537,11 +556,11 @@ public class QueryRunnerTest {
         final QueryRunner queryRunner = new QueryRunner(stmtConfig);
         queryRunner.prepareStatement(conn, "select 1");
 
-        verify(stmt).setFetchDirection(eq(1));
-        verify(stmt).setFetchSize(eq(2));
-        verify(stmt).setMaxFieldSize(eq(3));
-        verify(stmt).setMaxRows(eq(4));
-        verify(stmt).setQueryTimeout(eq(5));
+        verify(prepStmt).setFetchDirection(eq(1));
+        verify(prepStmt).setFetchSize(eq(2));
+        verify(prepStmt).setMaxFieldSize(eq(3));
+        verify(prepStmt).setMaxRows(eq(4));
+        verify(prepStmt).setQueryTimeout(eq(5));
     }
 
     //
@@ -720,7 +739,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testNoParamsExecute() throws Exception {
-        callExecuteWithException();
+        callGoodExecute();
     }
 
     @Test
@@ -757,7 +776,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testExecuteException() throws Exception {
-        doThrow(new SQLException()).when(stmt).execute();
+        doThrow(new SQLException()).when(prepStmt).execute();
 
         callExecuteWithException(handler, "unit", "test");
     }
@@ -943,7 +962,7 @@ public class QueryRunnerTest {
         try {
             when(call.execute()).thenReturn(true);
             when(meta.getParameterCount()).thenReturn(2);
-            runner.query("{call my_proc(?, ?)}", handler, params);
+            runner.execute("{call my_proc(?, ?)}", handler, params);
 
         } catch(final SQLException e) {
             caught = true;
@@ -993,7 +1012,7 @@ public class QueryRunnerTest {
 
     @Test
     public void testExecuteWithResultSetException() throws Exception {
-        doThrow(new SQLException()).when(stmt).execute();
+        doThrow(new SQLException()).when(prepStmt).execute();
 
         callExecuteWithResultSetWithException(handler, "unit", "test");
     }
@@ -1018,14 +1037,14 @@ public class QueryRunnerTest {
     public void testFillStatementWithBean() throws Exception {
         final MyBean bean = new MyBean();
         when(meta.getParameterCount()).thenReturn(3);
-        runner.fillStatementWithBean(stmt, bean, "a", "b", "c");
+        runner.fillStatementWithBean(prepStmt, bean, "a", "b", "c");
     }
 
     @Test(expected=NullPointerException.class)
     public void testFillStatementWithBeanNullNames() throws Exception {
         final MyBean bean = new MyBean();
         when(meta.getParameterCount()).thenReturn(3);
-        runner.fillStatementWithBean(stmt, bean, "a", "b", null);
+        runner.fillStatementWithBean(prepStmt, bean, "a", "b", null);
     }
 
     @Test(expected=SQLException.class)


[commons-dbutils] 05/05: Generate contributing, readme, jira, and mail-lists pages

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git

commit 0d9c321bf42c563dde469d6c5999b5d8c49f4e9c
Author: Carl Hall <th...@apache.org>
AuthorDate: Sat Jan 4 18:30:06 2020 -0800

    Generate contributing, readme, jira, and mail-lists pages
---
 README.md                        | 10 ++++++----
 src/site/xdoc/issue-tracking.xml |  4 ++--
 src/site/xdoc/mail-lists.xml     | 30 +++++++++++++++---------------
 3 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md
index 1105ac3..5607c32 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@
  | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
  +======================================================================+
  |                                                                      |
- | 1) Re-generate using: mvn commons:readme-md                          |
+ | 1) Re-generate using: mvn commons-build:readme-md                    |
  |                                                                      |
  | 2) Set the following properties in the component's pom:              |
  |    - commons.componentid (required, alphabetic, lower case)          |
@@ -43,8 +43,10 @@
 Apache Commons DbUtils
 ===================
 
-[![Build Status](https://travis-ci.org/apache/commons-dbutils.svg?branch=master)](https://travis-ci.org/apache/commons-dbutils)
+[![Build Status](https://travis-ci.org/apache/commons-dbutils.svg)](https://travis-ci.org/apache/commons-dbutils)
+[![Coverage Status](https://coveralls.io/repos/apache/commons-dbutils/badge.svg)](https://coveralls.io/r/apache/commons-dbutils)
 [![Maven Central](https://maven-badges.herokuapp.com/maven-central/commons-dbutils/commons-dbutils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/commons-dbutils/commons-dbutils/)
+[![Javadocs](https://javadoc.io/badge/commons-dbutils/commons-dbutils/1.8.svg)](https://javadoc.io/doc/commons-dbutils/commons-dbutils/1.8)
 
 The Apache Commons DbUtils package is a set of Java utility classes for easing JDBC development.
 
@@ -52,7 +54,7 @@ Documentation
 -------------
 
 More information can be found on the [Apache Commons DbUtils homepage](https://commons.apache.org/proper/commons-dbutils).
-The [Javadoc](https://commons.apache.org/proper/commons-dbutils/javadocs/api-release) can be browsed.
+The [Javadoc](https://commons.apache.org/proper/commons-dbutils/apidocs) can be browsed.
 Questions related to the usage of Apache Commons DbUtils should be posted to the [user mailing list][ml].
 
 Where can I get the latest release?
@@ -65,7 +67,7 @@ Alternatively you can pull it from the central Maven repositories:
 <dependency>
   <groupId>commons-dbutils</groupId>
   <artifactId>commons-dbutils</artifactId>
-  <version>1.7</version>
+  <version>1.8</version>
 </dependency>
 ```
 
diff --git a/src/site/xdoc/issue-tracking.xml b/src/site/xdoc/issue-tracking.xml
index 0d623b7..e102ffe 100644
--- a/src/site/xdoc/issue-tracking.xml
+++ b/src/site/xdoc/issue-tracking.xml
@@ -26,7 +26,7 @@ limitations under the License.
  | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
  +======================================================================+
  |                                                                      |
- | 1) Re-generate using: mvn commons:jira-page                          |
+ | 1) Re-generate using: mvn commons-build:jira-page                    |
  |                                                                      |
  | 2) Set the following properties in the component's pom:              |
  |    - commons.jira.id  (required, alphabetic, upper case)             |
@@ -86,7 +86,7 @@ limitations under the License.
 
       <p>
       For more information on subversion and creating patches see the
-      <a href="http://www.apache.org/dev/contributors.html">Apache Contributors Guide</a>.
+      <a href="https://www.apache.org/dev/contributors.html">Apache Contributors Guide</a>.
       </p>
 
       <p>
diff --git a/src/site/xdoc/mail-lists.xml b/src/site/xdoc/mail-lists.xml
index 478c627..cc66d4c 100644
--- a/src/site/xdoc/mail-lists.xml
+++ b/src/site/xdoc/mail-lists.xml
@@ -26,7 +26,7 @@ limitations under the License.
  | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
  +======================================================================+
  |                                                                      |
- | 1) Re-generate using: mvn commons:mail-page                          |
+ | 1) Re-generate using: mvn commons-build:mail-page                    |
  |                                                                      |
  | 2) Set the following properties in the component's pom:              |
  |    - commons.componentid (required, alphabetic, lower case)          |
@@ -106,9 +106,9 @@ limitations under the License.
           <td><a href="mailto:user-unsubscribe@commons.apache.org">Unsubscribe</a></td>
           <td><a href="mailto:user@commons.apache.org?subject=[dbutils]">Post</a></td>
           <td><a href="https://mail-archives.apache.org/mod_mbox/commons-user/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.users/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/user@commons.apache.org/">www.mail-archive.com</a><br />
-              <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
+          <td><a href="https://markmail.org/list/org.apache.commons.users/">markmail.org</a><br />
+              <a href="https://www.mail-archive.com/user@commons.apache.org/">www.mail-archive.com</a><br />
+              <a href="https://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
           </td>
         </tr>
 
@@ -124,9 +124,9 @@ limitations under the License.
           <td><a href="mailto:dev-unsubscribe@commons.apache.org">Unsubscribe</a></td>
           <td><a href="mailto:dev@commons.apache.org?subject=[dbutils]">Post</a></td>
           <td><a href="https://mail-archives.apache.org/mod_mbox/commons-dev/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.dev/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/dev@commons.apache.org/">www.mail-archive.com</a><br />
-              <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
+          <td><a href="https://markmail.org/list/org.apache.commons.dev/">markmail.org</a><br />
+              <a href="https://www.mail-archive.com/dev@commons.apache.org/">www.mail-archive.com</a><br />
+              <a href="https://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
           </td>
         </tr>
 
@@ -142,8 +142,8 @@ limitations under the License.
           <td><a href="mailto:issues-unsubscribe@commons.apache.org">Unsubscribe</a></td>
           <td><i>read only</i></td>
           <td><a href="https://mail-archives.apache.org/mod_mbox/commons-issues/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.issues/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/issues@commons.apache.org/">www.mail-archive.com</a>
+          <td><a href="https://markmail.org/list/org.apache.commons.issues/">markmail.org</a><br />
+              <a href="https://www.mail-archive.com/issues@commons.apache.org/">www.mail-archive.com</a>
           </td>
         </tr>
 
@@ -159,8 +159,8 @@ limitations under the License.
           <td><a href="mailto:commits-unsubscribe@commons.apache.org">Unsubscribe</a></td>
           <td><i>read only</i></td>
           <td><a href="https://mail-archives.apache.org/mod_mbox/commons-commits/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.commits/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/commits@commons.apache.org/">www.mail-archive.com</a>
+          <td><a href="https://markmail.org/list/org.apache.commons.commits/">markmail.org</a><br />
+              <a href="https://www.mail-archive.com/commits@commons.apache.org/">www.mail-archive.com</a>
           </td>
         </tr>
 
@@ -192,10 +192,10 @@ limitations under the License.
           <td><a class="externalLink" href="mailto:announce-unsubscribe@apache.org">Unsubscribe</a></td>
           <td><i>read only</i></td>
           <td><a class="externalLink" href="https://mail-archives.apache.org/mod_mbox/www-announce/">mail-archives.apache.org</a></td>
-          <td><a class="externalLink" href="http://markmail.org/list/org.apache.announce/">markmail.org</a><br />
-              <a class="externalLink" href="http://old.nabble.com/Apache-News-and-Announce-f109.html">old.nabble.com</a><br />
-              <a class="externalLink" href="http://www.mail-archive.com/announce@apache.org/">www.mail-archive.com</a><br />
-              <a class="externalLink" href="http://news.gmane.org/gmane.comp.apache.announce">news.gmane.org</a>
+          <td><a class="externalLink" href="https://markmail.org/list/org.apache.announce/">markmail.org</a><br />
+              <a class="externalLink" href="https://old.nabble.com/Apache-News-and-Announce-f109.html">old.nabble.com</a><br />
+              <a class="externalLink" href="https://www.mail-archive.com/announce@apache.org/">www.mail-archive.com</a><br />
+              <a class="externalLink" href="https://news.gmane.org/gmane.comp.apache.announce">news.gmane.org</a>
           </td>
         </tr>
       </table>


[commons-dbutils] 04/05: Update notice to 2020

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git

commit 7ff17e545fb0f96585108b12c210e55a2be0fd89
Author: Carl Hall <th...@apache.org>
AuthorDate: Sat Jan 4 18:27:17 2020 -0800

    Update notice to 2020
---
 NOTICE.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NOTICE.txt b/NOTICE.txt
index fd8a581..fb6ca8a 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
 Apache Commons DbUtils
-Copyright 2002-2019 The Apache Software Foundation
+Copyright 2002-2020 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).


[commons-dbutils] 02/05: Updated download page in preparation for 1.8 release

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git

commit b152c02f2226de115c5909539457637b60073424
Author: Carl Hall <th...@apache.org>
AuthorDate: Sat Jan 4 14:24:16 2020 -0800

    Updated download page in preparation for 1.8 release
---
 src/site/site.xml                  |   3 +-
 src/site/xdoc/download_dbutils.xml | 254 +++++++++++++++++++------------------
 2 files changed, 130 insertions(+), 127 deletions(-)

diff --git a/src/site/site.xml b/src/site/site.xml
index 841dcfd..05bf14b 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -39,7 +39,8 @@
             <item name="Issue Tracking"       href="/issue-tracking.html"/>
             <item name="Source Repository"    href="/scm.html"/>
             <item name="Building"             href="/building.html"/>
-            <item name="Javadoc 1.7"          href="apidocs/index.html"/>
+            <item name="Javadoc 1.8 (latest)" href="apidocs/index.html"/>
+            <item name="Javadoc 1.7"          href="archives/1.7/apidocs/index.html"/>
             <item name="Javadoc 1.6"          href="archives/1.6/apidocs/index.html"/>
         </menu>
 
diff --git a/src/site/xdoc/download_dbutils.xml b/src/site/xdoc/download_dbutils.xml
index 0c4b464..5e44343 100644
--- a/src/site/xdoc/download_dbutils.xml
+++ b/src/site/xdoc/download_dbutils.xml
@@ -1,142 +1,144 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<!--
- +======================================================================+
- |****                                                              ****|
- |****      THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN      ****|
- |****                    DO NOT EDIT DIRECTLY                      ****|
- |****                                                              ****|
- +======================================================================+
- | TEMPLATE FILE: download-page-template.xml                            |
- | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
- +======================================================================+
- |                                                                      |
- | 1) Re-generate using: mvn commons:download-page                      |
- |                                                                      |
- | 2) Set the following properties in the component's pom:              |
- |    - commons.componentid (required, alphabetic, lower case)          |
- |    - commons.release.version (required)                              |
- |    - commons.release.name    (required)                              |
- |    - commons.binary.suffix   (optional)                              |
- |      (defaults to "-bin", set to "" for pre-maven2 releases)         |
- |    - commons.release.desc    (optional)                              |
- |    - commons.release.subdir  (optional)                              |
- |                                                                      |
- |    - commons.release.2/3.version       (conditional)                 |
- |    - commons.release.2/3.name          (conditional)                 |
- |    - commons.release.2/3.binary.suffix (optional)                    |
- |    - commons.release.2/3.desc          (optional)                    |
- |    - commons.release.2/3.subdir        (optional)                    |
- |                                                                      |
- | 3) Example Properties                                                |
- |    (commons.release.name inherited by parent:                        |
- |     ${project.artifactId}-${commons.release.version}                 |
- |                                                                      |
- |  <properties>                                                        |
- |    <commons.componentid>math</commons.componentid>                   |
- |    <commons.release.version>1.2</commons.release.version>            |
- |  </properties>                                                       |
- |                                                                      |
- +======================================================================+
--->
-<document>
-  <properties>
-    <title>Download Apache Commons DbUtils</title>
-    <author email="dev@commons.apache.org">Apache Commons Documentation Team</author>
-  </properties>
-  <body>
-    <section name="Download Apache Commons DbUtils">
-    <subsection name="Using a Mirror">
-      <p>
-        We recommend you use a mirror to download our release
-        builds, but you <strong>must</strong> <a href="http://www.apache.org/info/verification.html">verify the integrity</a> of
-        the downloaded files using signatures downloaded from our main
-        distribution directories. Recent releases (48 hours) may not yet
-        be available from all the mirrors.
-      </p>
-
-      <p>
-        You are currently using <b>[preferred]</b>.  If you
-        encounter a problem with this mirror, please select another
-        mirror.  If all mirrors are failing, there are <i>backup</i>
-        mirrors (at the end of the mirrors list) that should be
-        available.
-        <br></br>
-        [if-any logo]<a href="[link]"><img align="right" src="[logo]" border="0"></img></a>[end]
-      </p>
-
-      <form action="[location]" method="get" id="SelectMirror">
-        <p>
-          Other mirrors:
-          <select name="Preferred">
-          [if-any http]
-            [for http]<option value="[http]">[http]</option>[end]
-          [end]
-          [if-any ftp]
-            [for ftp]<option value="[ftp]">[ftp]</option>[end]
-          [end]
-          [if-any backup]
-            [for backup]<option value="[backup]">[backup] (backup)</option>[end]
-          [end]
-          </select>
-          <input type="submit" value="Change"></input>
-        </p>
-      </form>
-
-      <p>
-        It is essential that you
-        <a href="https://www.apache.org/info/verification.html">verify the integrity</a>
-        of downloaded files, preferably using the <code>PGP</code> signature (<code>*.asc</code> files);
-        failing that using the <code>MD5</code> hash (<code>*.md5</code> checksum files).
-      </p>
-      <p>
-        The <a href="https://www.apache.org/dist/commons/KEYS">KEYS</a>
-        file contains the public PGP keys used by Apache Commons developers
-        to sign releases.
-      </p>
-    </subsection>
-    </section>
-    <section name="Apache Commons DbUtils 1.7 ">
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<!--
+ +======================================================================+
+ |****                                                              ****|
+ |****      THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN      ****|
+ |****                    DO NOT EDIT DIRECTLY                      ****|
+ |****                                                              ****|
+ +======================================================================+
+ | TEMPLATE FILE: download-page-template.xml                            |
+ | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
+ +======================================================================+
+ |                                                                      |
+ | 1) Re-generate using: mvn commons-build:download-page                |
+ |                                                                      |
+ | 2) Set the following properties in the component's pom:              |
+ |    - commons.componentid     (required, alphabetic, lower case)      |
+ |    - commons.release.version (required)                              |
+ |    - commons.release.name    (required)                              |
+ |    - commons.binary.suffix   (optional)                              |
+ |      (defaults to "-bin", set to "" for pre-maven2 releases)         |
+ |    - commons.release.desc    (optional)                              |
+ |    - commons.release.subdir  (optional)                              |
+ |    - commons.release.hash    (optional, lowercase, default sha512)   |
+ |                                                                      |
+ |    - commons.release.[234].version       (conditional)               |
+ |    - commons.release.[234].name          (conditional)               |
+ |    - commons.release.[234].binary.suffix (optional)                  |
+ |    - commons.release.[234].desc          (optional)                  |
+ |    - commons.release.[234].subdir        (optional)                  |
+ |    - commons.release.[234].hash       (optional, lowercase, [sha512])|
+ |                                                                      |
+ | 3) Example Properties                                                |
+ |    (commons.release.name inherited by parent:                        |
+ |     ${project.artifactId}-${commons.release.version}                 |
+ |                                                                      |
+ |  <properties>                                                        |
+ |    <commons.componentid>math</commons.componentid>                   |
+ |    <commons.release.version>1.2</commons.release.version>            |
+ |  </properties>                                                       |
+ |                                                                      |
+ +======================================================================+
+-->
+<document>
+  <properties>
+    <title>Download Apache Commons DbUtils</title>
+    <author email="dev@commons.apache.org">Apache Commons Documentation Team</author>
+  </properties>
+  <body>
+    <section name="Download Apache Commons DbUtils">
+    <subsection name="Using a Mirror">
+      <p>
+        We recommend you use a mirror to download our release
+        builds, but you <strong>must</strong> <a href="https://www.apache.org/info/verification.html">verify the integrity</a> of
+        the downloaded files using signatures downloaded from our main
+        distribution directories. Recent releases (48 hours) may not yet
+        be available from all the mirrors.
+      </p>
+
+      <p>
+        You are currently using <b>[preferred]</b>.  If you
+        encounter a problem with this mirror, please select another
+        mirror.  If all mirrors are failing, there are <i>backup</i>
+        mirrors (at the end of the mirrors list) that should be
+        available.
+        <br></br>
+        [if-any logo]<a href="[link]"><img align="right" src="[logo]" border="0"></img></a>[end]
+      </p>
+
+      <form action="[location]" method="get" id="SelectMirror">
+        <p>
+          Other mirrors:
+          <select name="Preferred">
+          [if-any http]
+            [for http]<option value="[http]">[http]</option>[end]
+          [end]
+          [if-any ftp]
+            [for ftp]<option value="[ftp]">[ftp]</option>[end]
+          [end]
+          [if-any backup]
+            [for backup]<option value="[backup]">[backup] (backup)</option>[end]
+          [end]
+          </select>
+          <input type="submit" value="Change"></input>
+        </p>
+      </form>
+
+      <p>
+        It is essential that you
+        <a href="https://www.apache.org/info/verification.html">verify the integrity</a>
+        of downloaded files, preferably using the <code>PGP</code> signature (<code>*.asc</code> files);
+        failing that using the <code>SHA512</code> hash (<code>*.sha512</code> checksum files).
+      </p>
+      <p>
+        The <a href="https://www.apache.org/dist/commons/KEYS">KEYS</a>
+        file contains the public PGP keys used by Apache Commons developers
+        to sign releases.
+      </p>
+    </subsection>
+    </section>
+    <section name="Apache Commons DbUtils 1.8 ">
       <subsection name="Binaries">
         <table>
           <tr>
-              <td><a href="[preferred]/commons/dbutils/binaries/commons-dbutils-1.7-bin.tar.gz">commons-dbutils-1.7-bin.tar.gz</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.7-bin.tar.gz.md5">md5</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.7-bin.tar.gz.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbutils/binaries/commons-dbutils-1.8-bin.tar.gz">commons-dbutils-1.8-bin.tar.gz</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.8-bin.tar.gz.sha512">sha512</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.8-bin.tar.gz.asc">pgp</a></td>
           </tr>
           <tr>
-              <td><a href="[preferred]/commons/dbutils/binaries/commons-dbutils-1.7-bin.zip">commons-dbutils-1.7-bin.zip</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.7-bin.zip.md5">md5</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.7-bin.zip.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbutils/binaries/commons-dbutils-1.8-bin.zip">commons-dbutils-1.8-bin.zip</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.8-bin.zip.sha512">sha512</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/binaries/commons-dbutils-1.8-bin.zip.asc">pgp</a></td>
           </tr>
         </table>
       </subsection>
       <subsection name="Source">
         <table>
           <tr>
-              <td><a href="[preferred]/commons/dbutils/source/commons-dbutils-1.7-src.tar.gz">commons-dbutils-1.7-src.tar.gz</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.7-src.tar.gz.md5">md5</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.7-src.tar.gz.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbutils/source/commons-dbutils-1.8-src.tar.gz">commons-dbutils-1.8-src.tar.gz</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.8-src.tar.gz.sha512">sha512</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.8-src.tar.gz.asc">pgp</a></td>
           </tr>
           <tr>
-              <td><a href="[preferred]/commons/dbutils/source/commons-dbutils-1.7-src.zip">commons-dbutils-1.7-src.zip</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.7-src.zip.md5">md5</a></td>
-              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.7-src.zip.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbutils/source/commons-dbutils-1.8-src.zip">commons-dbutils-1.8-src.zip</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.8-src.zip.sha512">sha512</a></td>
+              <td><a href="https://www.apache.org/dist/commons/dbutils/source/commons-dbutils-1.8-src.zip.asc">pgp</a></td>
           </tr>
         </table>
       </subsection>


[commons-dbutils] 03/05: Updating release details for 1.8

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git

commit 8c70e674c8eb15c6a0d5df1b416bc56a89d6b6e2
Author: Carl Hall <th...@apache.org>
AuthorDate: Sat Jan 4 13:52:45 2020 -0800

    Updating release details for 1.8
---
 RELEASE-NOTES.txt       | 26 ++++++++++++--------------
 pom.xml                 |  6 ++++--
 src/changes/changes.xml |  2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index a6445b7..421be73 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,32 +1,30 @@
 
               Apache Commons DbUtils
-                     Version 1.7
+                     Version 1.8
                     RELEASE NOTES
 
-The Apache Commons DbUtils team is pleased to announce the release of Apache Commons DbUtils 1.7
+The Apache Commons DbUtils team is pleased to announce the release of Apache Commons DbUtils 1.8
 
 The Apache Commons DbUtils package is a set of Java utility classes for easing JDBC development.
 
-Bugfixes and separate column & property handlers using SPI
+New features and bug fixes.
 
 Changes in this version include:
 
 New features:
-o DBUTILS-121:  Add getWriteMethod to BeanProcessor to allow subclasses to influence which write method is used 
-o DBUTILS-50:  Support CallableStatement "out" parameters Thanks to Dan Fabulich. 
-o DBUTILS-124:  Implement column and property handlers using Java's service interfaces. 
+o PR/9:         Add @Column annotation to hint the field name instead of dissecting the get method name. Thanks to rewerma.
+o DBUTILS-136:  CaseInsensitiveHashMap cannot be accessed by subclasses of BasicRowProcessor; add org.apache.commons.dbutils.BasicRowProcessor.createCaseInsensitiveHashMap(int). Thanks to Matthew Hall, Gary Gregory. 
 
 Fixed Bugs:
-o DBUTILS-82:  Change method contracts to allow extended class types when returning a bean populated from a query Thanks to Kenshi Toriumi. 
-o DBUTILS-89:  Add method in BeanProcessor to populate an existing bean Thanks to Adam Dyga. 
-o DBUTILS-70:  Add ability to configure statements used in QueryRunner Thanks to Michael Akerman. 
+o DBUTILS-131:  Speedup query calls without parameters; Use PreparedStatement only when parameters are present. Thanks to yairlenga. 
+o           Always copy Date, Time, Timestamp on get and set in SqlNullCheckedResultSet. 
+o DBUTILS-138:  org.apache.commons.dbutils.QueryRunner.query(Connection, boolean, String, ResultSetHandler<T>, Object...) Exception in closing statement leave connections open. Thanks to Stefano Lissa, Gary Gregory. 
+o DBUTILS-139:  Update Java requirement from version 6 to 7. Thanks to Gary Gregory. 
 
 Changes:
-o DBUTILS-117:  Error handling possible getParameterMetaData() results
-        - allow for null return
-        - handle SQLFeatureNotSupportedException Thanks to Vadim Smirnov. 
-o DBUTILS-119:  Correct errors in BeanMapHandler Javadoc Thanks to Michael Akerman. 
-o PR/1:  Created some Unit Tests to increase code coverage. Thanks to Michael Hausegger. 
+o DBUTILS-135:  BeanProcessor is not thread safe since [DBUTILS-124]. Thanks to hdevalke. 
+o DBUTILS-137:  Inefficient allocation of Maps in org.apache.commons.dbutils.BasicRowProcessor.toMap(ResultSet). Thanks to Gary Gregory. 
+o           clirr, checkstyle, and spotbugs configured as part of default build. Thanks to thecarlhall. 
 
 
 For complete information on Apache Commons DbUtils, including instructions on how to submit bug reports,
diff --git a/pom.xml b/pom.xml
index 09d5396..c7cbb19 100644
--- a/pom.xml
+++ b/pom.xml
@@ -251,11 +251,13 @@
 
     <commons.componentid>dbutils</commons.componentid>
     <commons.module.name>org.apache.commons.dbutils</commons.module.name>
-    <commons.release.version>2.0</commons.release.version>
-    <commons.rc.version>RC2</commons.rc.version>
+    <commons.release.version>1.8</commons.release.version>
+    <commons.rc.version>RC1</commons.rc.version>
     <commons.bc.version>1.7</commons.bc.version>
     <commons.jira.id>DBUTILS</commons.jira.id>
     <commons.jira.pid>12310470</commons.jira.pid>
+    <commons.releaseManagerName>Carl Hall</commons.releaseManagerName>
+    <commons.releaseManagerKey>1e5ab6d3cf8ebf5f</commons.releaseManagerKey>
   </properties>
 
   <build>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 19f77fe..6e81ca5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,7 +51,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="thecarlhall" type="fix">
         Always copy Date, Time, Timestamp on get and set in SqlNullCheckedResultSet.
       </action>
-      <action dev="thecarlhall" type="add" due-to="rewerma">
+      <action dev="thecarlhall" type="add" issue="PR/9" due-to="rewerma">
         Add @Column annotation to hint the field name instead of dissecting the get method name.
       </action>
       <action dev="ggregory" type="update" issue="DBUTILS-135" due-to="hdevalke">