commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r998525 - /commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java
Date Sat, 18 Sep 2010 19:18:04 GMT
Author: psteitz
Date: Sat Sep 18 19:18:04 2010
New Revision: 998525

URL: http://svn.apache.org/viewvc?rev=998525&view=rev
Log:
Support no-op as query option.

Modified:
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java?rev=998525&r1=998524&r2=998525&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java
(original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java
Sat Sep 18 19:18:04 2010
@@ -36,7 +36,7 @@ import org.apache.commons.performance.St
  */
 public class DBCPClientThread extends ClientThread {
     /** Initial segment of query string */
-    private String queryString;
+    private String queryString = null;
     /** Whether or not the query is on the text column */
     private boolean textQuery = false;
     /** DataSource used to connect */
@@ -76,6 +76,10 @@ public class DBCPClientThread extends Cl
         
         this.dataSource = dataSource;
         
+        if (queryType.equals("no-op")) {
+            return;
+        }
+        
         if (queryType.equals("integerIndexed")) {
             queryString = "select * from test_table WHERE indexed=";
         } else if (queryType.equals("integerScan")) {
@@ -88,6 +92,9 @@ public class DBCPClientThread extends Cl
     
     /** Generate a random query */
     public void setUp() throws Exception {
+        if (queryString == null) {
+            return;
+        }
         if (textQuery) {
             currentQuery = queryString +
                 randomData.nextHexString(20) + "';";
@@ -100,6 +107,9 @@ public class DBCPClientThread extends Cl
     /** Execute query */
     public void execute() throws Exception {
         conn = dataSource.getConnection();
+        if (queryString == null) {
+            return;
+        }
         Statement stmt = conn.createStatement();
         stmt.execute(currentQuery);
         ResultSet rs = stmt.getResultSet();



Mime
View raw message