Author: mamta Date: Fri May 31 21:13:26 2013 New Revision: 1488402 URL: http://svn.apache.org/r1488402 Log: DERBY-6237(PreparedStatement.execute() fails starting 10.2 when multiple rows are updated and PreparedStatement.setCharacterStream(int, Reader, int) is used) The test will verify the updated data in the CLOB column Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java?rev=1488402&r1=1488401&r2=1488402&view=diff ============================================================================== --- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java (original) +++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java Fri May 31 21:13:26 2013 @@ -28,6 +28,7 @@ import org.apache.derbyTesting.functionT import java.sql.*; +import java.util.Arrays; import java.math.*; import java.io.*; @@ -2979,6 +2980,7 @@ public class parameterMapping { { CharAlphabet a1 = CharAlphabet.singleChar('a'); + //Following will update one or 2 rows depending on the 1st param PreparedStatement ps = conn.prepareStatement( "UPDATE TestUpdateCharStream SET c3 = ?, " + "c2 = c2 + 1 WHERE c1 IN (?, ?)"); @@ -3008,13 +3010,64 @@ public class parameterMapping { //Second value in IN clause is also getting set to 'EEEEE', which // means prepared statement will update two rows ps.setObject(3, "EEEEE", Types.VARCHAR); - } - + } ps.execute(); + + //verify updated data + ResultSet rs; + ps = conn.prepareStatement( + "select c3 from TestUpdateCharStream " + + "WHERE c1 IN (?, ?)"); + ps.setCharacterStream(1, new CharArrayReader("AAAAA".toCharArray()), 5); + if (numberOfRowsToUpdate == 1 ) { + ps.setObject(2, "AAAAA", Types.VARCHAR); + } else { + ps.setObject(2, "EEEEE", Types.VARCHAR); + } + rs = ps.executeQuery(); + char[] c; + if (testVariation == 1){ + //we are here to test short data + c = new char[50]; + Arrays.fill(c, 'a'); + } else { + //we are here to test large data + c = new char[50000]; + Arrays.fill(c, 'a'); + } + for (int i=0;i