commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wspe...@apache.org
Subject svn commit: r1450478 - in /commons/proper/dbutils/branches/2_0/src: main/java/org/apache/commons/dbutils/ test/java/org/apache/commons/dbutils/
Date Tue, 26 Feb 2013 22:05:27 GMT
Author: wspeirs
Date: Tue Feb 26 22:05:27 2013
New Revision: 1450478

URL: http://svn.apache.org/r1450478
Log:
Renamed some files
- Updated InsertExecutor to provide another insert method

Added:
    commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java
      - copied, changed from r1450009, commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
    commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncExecutorTest.java
      - copied, changed from r1450009, commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
Removed:
    commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
    commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
Modified:
    commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/InsertExecutor.java

Copied: commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java
(from r1450009, commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java)
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java?p2=commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java&p1=commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java&r1=1450009&r2=1450478&rev=1450478&view=diff
==============================================================================
--- commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
(original)
+++ commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java
Tue Feb 26 22:05:27 2013
@@ -27,7 +27,7 @@ import java.util.concurrent.Future;
  * @author William Speirs <wspeirs@apache.org>
  * @since 2.0
  */
-public class AsyncQueryRunner {
+public class AsyncExecutor {
 
     private final ExecutorService executorService;
 
@@ -37,7 +37,7 @@ public class AsyncQueryRunner {
      * @param executorService the {@code ExecutorService} instance used to run JDBC invocations
concurrently.
      * @param queryRunner the {@code QueryRunner} instance to use for the queries.
      */
-    public AsyncQueryRunner(ExecutorService executorService) {
+    public AsyncExecutor(ExecutorService executorService) {
         this.executorService = executorService;
     }
 

Modified: commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/InsertExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/InsertExecutor.java?rev=1450478&r1=1450477&r2=1450478&view=diff
==============================================================================
--- commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/InsertExecutor.java
(original)
+++ commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils/InsertExecutor.java
Tue Feb 26 22:05:27 2013
@@ -73,4 +73,26 @@ public class InsertExecutor extends Abst
         return null;
     }
     
+    /**
+     * Executes the given INSERT SQL statement.
+     * 
+     * @throws SQLException If there are database or parameter errors.
+     */
+    public void insert() throws SQLException {
+        // throw an exception if there are unmapped parameters
+        this.throwIfUnmappedParams();
+
+        try {
+            // execute the insert
+            getStatement().executeUpdate();
+        } catch (SQLException e) {
+            this.rethrow(e);
+        } finally {
+            close(getStatement());
+            if (closeConn) {
+                close(getConnection());
+            }
+        }
+    }
+    
 }

Copied: commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncExecutorTest.java
(from r1450009, commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java)
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncExecutorTest.java?p2=commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncExecutorTest.java&p1=commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java&r1=1450009&r2=1450478&rev=1450478&view=diff
==============================================================================
--- commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
(original)
+++ commons/proper/dbutils/branches/2_0/src/test/java/org/apache/commons/dbutils/AsyncExecutorTest.java
Tue Feb 26 22:05:27 2013
@@ -28,8 +28,8 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
 @SuppressWarnings("boxing") // test code
-public class AsyncQueryRunnerTest {
-    AsyncQueryRunner runner;
+public class AsyncExecutorTest {
+    AsyncExecutor runner;
 
     @Mock QueryRunner qRunner;
     @Mock ResultSetHandler<Object> handler;
@@ -41,7 +41,7 @@ public class AsyncQueryRunnerTest {
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);    // init the mocks
 
-         runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
+         runner = new AsyncExecutor(Executors.newFixedThreadPool(1));
     }
 
     @Test



Mime
View raw message