db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1507212 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java
Date Fri, 26 Jul 2013 08:29:24 GMT
Author: kahatlen
Date: Fri Jul 26 08:29:23 2013
New Revision: 1507212

URL: http://svn.apache.org/r1507212
Log:
DERBY-4378: Create test cases for MultiProbeTableScanResultSet with duplicates in the probe
list

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java?rev=1507212&r1=1507211&r2=1507212&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/InListMultiProbeTest.java
Fri Jul 26 08:29:23 2013
@@ -1367,6 +1367,36 @@ public class InListMultiProbeTest extend
     }
 
     /**
+     * Test case that exercises an otherwise untested code path through
+     * {@code MultiProbeTableScanResultSet.getNextProbeValue()}, as suggested
+     * in DERBY-4378. The code path is taken if the highest value in the
+     * IN list is duplicated. Since duplicate literals are removed during
+     * compilation, the values must be non-literals for the path to be taken.
+     */
+    public void testDuplicateParameters() throws SQLException {
+        // Disable auto-commit to allow easy cleanup with rollback().
+        setAutoCommit(false);
+
+        // Create a test table.
+        Statement s = createStatement();
+        s.execute("create table d4378(x int primary key, y int)");
+        s.execute("insert into d4378 values (1,2),(3,4),(5,6),(7,8),(9,10)");
+        s.execute("insert into d4378 select y, x from d4378");
+
+        // Perform a query where all the elements in the probe list are
+        // parameters, and all parameters are set to the same value.
+        PreparedStatement ps =
+                prepareStatement("select * from d4378 where x in (?,?,?)");
+        ps.setInt(1, 1);
+        ps.setInt(2, 1);
+        ps.setInt(3, 1);
+        JDBC.assertFullResultSet(
+                ps.executeQuery(), new String[][] {{"1", "2"}});
+
+        rollback();
+    }
+
+    /**
      * Insert the received number of rows into DATA_TABLE via
      * batch processing.
      */



Mime
View raw message