public void testBug71672() throws SQLException {
  boolean lastTest=false;
  int testStep=0;
  Connection testConn=null;
  Statement testStmt=null;
  PreparedStatement testPStmt=null;
  ResultSet testRS=null;
  int[] res=null;
  int[] expectedUpdCount=null;
  int[][] expectedGenKeys=null;
  int[][] expectedGenKeysBatchStmt=null;
  int[] expectedGenKeysMultiQueries=null;
  int[] expectedUpdCountBatchPStmt=null;
  int[] expectedGenKeysBatchPStmt=null;
  final String tableDDL="(id INT AUTO_INCREMENT PRIMARY KEY, ch CHAR(1) UNIQUE KEY, ct INT)";
  final String[] queries=new String[]{"INSERT INTO testBug71672 (ch, ct) VALUES ('A', 100), ('C', 100), ('D', 100)","INSERT INTO testBug71672 (ch, ct) VALUES ('B', 2), ('C', 3), ('D', 4), ('E', 5) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))","INSERT INTO testBug71672 (ch, ct) VALUES ('F', 100) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))","INSERT INTO testBug71672 (ch, ct) VALUES ('B', 2), ('F', 6) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))","INSERT INTO testBug71672 (ch, ct) VALUES ('G', 100)"};
  final int[] expectedUpdCountDef=new int[]{3,6,1,4,1};
  final int[][] expectedGenKeysForChkODKU=new int[][]{{1,2,3},{4},{8},{8},{11}};
  final int[][] expectedGenKeysForNoChkODKU=new int[][]{{1,2,3},{4,5,6,7,8,9},{8},{8,9,10,11},{11}};
  final int[][] expectedGenKeysForBatchStmtRW=new int[][]{{1},{4},{8},{8},{11}};
  final int[] expectedUpdCountDef51=new int[]{3,8,1,6,1};
  final int[][] expectedGenKeysForChkODKU51=new int[][]{{1,2,3},{4},{6},{6},{7}};
  final int[][] expectedGenKeysForNoChkODKU51=new int[][]{{1,2,3},{4,5,6,7,8,9,10,11},{6},{6,7,8,9,10,11},{7}};
  final int[][] expectedGenKeysForBatchStmtRW51=new int[][]{{1},{4},{6},{6},{7}};
  final String queryBatchPStmt="INSERT INTO testBug71672 (ch, ct) VALUES (?, ?) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))";
  final String[] paramsBatchPStmt=new String[]{"A100","C100","D100","B2","C3","D4","E5","F100","B2","F6","G100"};
  final int[] expectedUpdCountBatchPStmtNoRW=new int[]{1,1,1,1,2,2,1,1,2,2,1};
  final int sni=Statement.SUCCESS_NO_INFO;
  final int[] expectedUpdCountBatchPStmtRW=new int[]{sni,sni,sni,sni,sni,sni,sni,sni,sni,sni,sni};
  final int[] expectedGenKeysForBatchPStmtChkODKU=new int[]{1,2,3,4,2,3,7,8,4,8,11};
  final int[] expectedGenKeysForBatchPStmtNoChkODKU=new int[]{1,2,3,4,2,3,3,4,7,8,4,5,8,9,11};
  final int[] expectedGenKeysForBatchPStmtRW=new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  final int[] expectedUpdCountBatchPStmtNoRW51=new int[]{1,1,1,1,3,3,1,1,3,3,1};
  final int[] expectedGenKeysForBatchPStmtChkODKU51=new int[]{1,2,3,4,2,3,5,6,4,6,7};
  final int[] expectedGenKeysForBatchPStmtNoChkODKU51=new int[]{1,2,3,4,2,3,4,3,4,5,5,6,4,5,6,6,7,8,7};
  final int[] expectedGenKeysForBatchPStmtRW51=new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
  do {
switch (++testStep) {
case 1:
      testConn=getConnectionWithProps("");
    expectedUpdCount=versionMeetsMinimum(5,5) ? expectedUpdCountDef : expectedUpdCountDef51;
  expectedGenKeys=versionMeetsMinimum(5,5) ? expectedGenKeysForChkODKU : expectedGenKeysForChkODKU51;
expectedGenKeysBatchStmt=expectedGenKeys;
expectedUpdCountBatchPStmt=versionMeetsMinimum(5,5) ? expectedUpdCountBatchPStmtNoRW : expectedUpdCountBatchPStmtNoRW51;
expectedGenKeysBatchPStmt=versionMeetsMinimum(5,5) ? expectedGenKeysForBatchPStmtChkODKU : expectedGenKeysForBatchPStmtChkODKU51;
break;
case 2:
testConn=getConnectionWithProps("dontCheckOnDuplicateKeyUpdateInSQL=true");
expectedUpdCount=versionMeetsMinimum(5,5) ? expectedUpdCountDef : expectedUpdCountDef51;
expectedGenKeys=versionMeetsMinimum(5,5) ? expectedGenKeysForNoChkODKU : expectedGenKeysForNoChkODKU51;
expectedGenKeysBatchStmt=expectedGenKeys;
expectedUpdCountBatchPStmt=versionMeetsMinimum(5,5) ? expectedUpdCountBatchPStmtNoRW : expectedUpdCountBatchPStmtNoRW51;
expectedGenKeysBatchPStmt=versionMeetsMinimum(5,5) ? expectedGenKeysForBatchPStmtNoChkODKU : expectedGenKeysForBatchPStmtNoChkODKU51;
break;
case 3:
testConn=getConnectionWithProps("rewriteBatchedStatements=true");
expectedUpdCount=versionMeetsMinimum(5,5) ? expectedUpdCountDef : expectedUpdCountDef51;
expectedGenKeys=versionMeetsMinimum(5,5) ? expectedGenKeysForChkODKU : expectedGenKeysForChkODKU51;
expectedGenKeysBatchStmt=versionMeetsMinimum(5,5) ? expectedGenKeysForBatchStmtRW : expectedGenKeysForBatchStmtRW51;
expectedUpdCountBatchPStmt=expectedUpdCountBatchPStmtRW;
expectedGenKeysBatchPStmt=versionMeetsMinimum(5,5) ? expectedGenKeysForBatchPStmtRW : expectedGenKeysForBatchPStmtRW51;
break;
case 4:
testConn=getConnectionWithProps("rewriteBatchedStatements=true,dontCheckOnDuplicateKeyUpdateInSQL=true");
expectedUpdCount=versionMeetsMinimum(5,5) ? expectedUpdCountDef : expectedUpdCountDef51;
expectedGenKeys=versionMeetsMinimum(5,5) ? expectedGenKeysForChkODKU : expectedGenKeysForChkODKU51;
expectedGenKeysBatchStmt=versionMeetsMinimum(5,5) ? expectedGenKeysForBatchStmtRW : expectedGenKeysForBatchStmtRW51;
expectedUpdCountBatchPStmt=expectedUpdCountBatchPStmtRW;
expectedGenKeysBatchPStmt=versionMeetsMinimum(5,5) ? expectedGenKeysForBatchPStmtRW : expectedGenKeysForBatchPStmtRW51;
lastTest=true;
break;
}
createTable("testBug71672",tableDDL);
for (int i=0; i < queries.length; i++) {
testBug71672Statement(testStep,testConn,queries[i],-1,expectedGenKeys[i]);
}
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
for (int i=0; i < queries.length; i++) {
testBug71672Statement(testStep,testConn,queries[i],expectedUpdCount[i],expectedGenKeys[i]);
}
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
testStmt=testConn.createStatement();
for (String query : queries) {
testStmt.addBatch(query);
}
res=testStmt.executeBatch();
assertEquals(testStep + ". Satement.executeBatch() result",expectedUpdCount.length,res.length);
for (int i=0; i < expectedUpdCount.length; i++) {
assertEquals(testStep + "." + i+ ". Satement.executeBatch() result",expectedUpdCount[i],res[i]);
}
testRS=testStmt.getGeneratedKeys();
for (int i=0; i < expectedGenKeysBatchStmt.length; i++) {
for (int j=0; j < expectedGenKeysBatchStmt[i].length; j++) {
assertTrue(testStep + ". Row expected in generated keys ResultSet",testRS.next());
assertEquals(testStep + ".[" + i+ "]["+ j+ "]. Wrong generated key",expectedGenKeysBatchStmt[i][j],testRS.getInt(1));
}
}
assertFalse(testStep + ". No more rows expected in generated keys ResultSet",testRS.next());
testRS.close();
testStmt.close();
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
for (int i=0; i < queries.length; i++) {
testBug71672PreparedStatement(testStep,testConn,queries[i],-1,expectedGenKeys[i]);
}
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
for (int i=0; i < queries.length; i++) {
testBug71672PreparedStatement(testStep,testConn,queries[i],expectedUpdCount[i],expectedGenKeys[i]);
}
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
testPStmt=testConn.prepareStatement(queryBatchPStmt,Statement.RETURN_GENERATED_KEYS);
for (String param : paramsBatchPStmt) {
testPStmt.setString(1,param.substring(0,1));
testPStmt.setInt(2,Integer.parseInt(param.substring(1)));
testPStmt.addBatch();
}
res=testPStmt.executeBatch();
assertEquals(testStep + ". PreparedSatement.executeBatch() result",expectedUpdCountBatchPStmt.length,res.length);
for (int i=0; i < expectedUpdCountBatchPStmt.length; i++) {
assertEquals(testStep + "." + i+ ". PreparedSatement.executeBatch() result",expectedUpdCountBatchPStmt[i],res[i]);
}
testRS=testPStmt.getGeneratedKeys();
for (int i=0; i < expectedGenKeysBatchPStmt.length; i++) {
assertTrue(testStep + ". Row expected in generated keys ResultSet",testRS.next());
assertEquals(testStep + ".[" + i+ "]. Wrong generated key",expectedGenKeysBatchPStmt[i],testRS.getInt(1));
}
assertFalse(testStep + ". No more rows expected in generated keys ResultSet",testRS.next());
testRS.close();
testPStmt.close();
dropTable("testBug71672");
testConn.close();
}
 while (!lastTest);
lastTest=false;
String allQueries="";
for (String q : queries) {
allQueries+=q + ";";
}
do {
switch (++testStep) {
case 5:
testConn=getConnectionWithProps("allowMultiQueries=true");
expectedGenKeysMultiQueries=new int[]{1};
break;
case 6:
testConn=getConnectionWithProps("allowMultiQueries=true,dontCheckOnDuplicateKeyUpdateInSQL=true");
expectedGenKeysMultiQueries=new int[]{1,2,3};
lastTest=true;
break;
}
createTable("testBug71672",tableDDL);
testBug71672Statement(testStep,testConn,allQueries,-1,expectedGenKeysMultiQueries);
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
testBug71672Statement(testStep,testConn,allQueries,3,expectedGenKeysMultiQueries);
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
testBug71672PreparedStatement(testStep,testConn,allQueries,-1,expectedGenKeysMultiQueries);
dropTable("testBug71672");
createTable("testBug71672",tableDDL);
testBug71672PreparedStatement(testStep,testConn,allQueries,3,expectedGenKeysMultiQueries);
dropTable("testBug71672");
testConn.close();
}
 while (!lastTest);
}

public void testBug71672 ( ) throws SQLException { boolean lastTest = false ; int testStep = 0 ; Connection testConn = null ; Statement testStmt = null ; PreparedStatement testPStmt = null ; ResultSet testRS = null ; int [ ] res = null ; int [ ] expectedUpdCount = null ; int [ ] [ ] expectedGenKeys = null ; int [ ] [ ] expectedGenKeysBatchStmt = null ; int [ ] expectedGenKeysMultiQueries = null ; int [ ] expectedUpdCountBatchPStmt = null ; int [ ] expectedGenKeysBatchPStmt = null ; final String tableDDL = "(id INT AUTO_INCREMENT PRIMARY KEY, ch CHAR(1) UNIQUE KEY, ct INT)" ; final String [ ] queries = new String [ ] { "INSERT INTO testBug71672 (ch, ct) VALUES ('A', 100), ('C', 100), ('D', 100)" , "INSERT INTO testBug71672 (ch, ct) VALUES ('B', 2), ('C', 3), ('D', 4), ('E', 5) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))" , "INSERT INTO testBug71672 (ch, ct) VALUES ('F', 100) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))" , "INSERT INTO testBug71672 (ch, ct) VALUES ('B', 2), ('F', 6) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))" , "INSERT INTO testBug71672 (ch, ct) VALUES ('G', 100)" } ; final int [ ] expectedUpdCountDef = new int [ ] { 3 , 6 , 1 , 4 , 1 } ; final int [ ] [ ] expectedGenKeysForChkODKU = new int [ ] [ ] { { 1 , 2 , 3 } , { 4 } , { 8 } , { 8 } , { 11 } } ; final int [ ] [ ] expectedGenKeysForNoChkODKU = new int [ ] [ ] { { 1 , 2 , 3 } , { 4 , 5 , 6 , 7 , 8 , 9 } , { 8 } , { 8 , 9 , 10 , 11 } , { 11 } } ; final int [ ] [ ] expectedGenKeysForBatchStmtRW = new int [ ] [ ] { { 1 } , { 4 } , { 8 } , { 8 } , { 11 } } ; final int [ ] expectedUpdCountDef51 = new int [ ] { 3 , 8 , 1 , 6 , 1 } ; final int [ ] [ ] expectedGenKeysForChkODKU51 = new int [ ] [ ] { { 1 , 2 , 3 } , { 4 } , { 6 } , { 6 } , { 7 } } ; final int [ ] [ ] expectedGenKeysForNoChkODKU51 = new int [ ] [ ] { { 1 , 2 , 3 } , { 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 } , { 6 } , { 6 , 7 , 8 , 9 , 10 , 11 } , { 7 } } ; final int [ ] [ ] expectedGenKeysForBatchStmtRW51 = new int [ ] [ ] { { 1 } , { 4 } , { 6 } , { 6 } , { 7 } } ; final String queryBatchPStmt = "INSERT INTO testBug71672 (ch, ct) VALUES (?, ?) ON DUPLICATE KEY UPDATE ct = -1 * (ABS(ct) + VALUES(ct))" ; final String [ ] paramsBatchPStmt = new String [ ] { "A100" , "C100" , "D100" , "B2" , "C3" , "D4" , "E5" , "F100" , "B2" , "F6" , "G100" } ; final int [ ] expectedUpdCountBatchPStmtNoRW = new int [ ] { 1 , 1 , 1 , 1 , 2 , 2 , 1 , 1 , 2 , 2 , 1 } ; final int sni = Statement . SUCCESS_NO_INFO ; final int [ ] expectedUpdCountBatchPStmtRW = new int [ ] { sni , sni , sni , sni , sni , sni , sni , sni , sni , sni , sni } ; final int [ ] expectedGenKeysForBatchPStmtChkODKU = new int [ ] { 1 , 2 , 3 , 4 , 2 , 3 , 7 , 8 , 4 , 8 , 11 } ; final int [ ] expectedGenKeysForBatchPStmtNoChkODKU = new int [ ] { 1 , 2 , 3 , 4 , 2 , 3 , 3 , 4 , 7 , 8 , 4 , 5 , 8 , 9 , 11 } ; final int [ ] expectedGenKeysForBatchPStmtRW = new int [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 } ; final int [ ] expectedUpdCountBatchPStmtNoRW51 = new int [ ] { 1 , 1 , 1 , 1 , 3 , 3 , 1 , 1 , 3 , 3 , 1 } ; final int [ ] expectedGenKeysForBatchPStmtChkODKU51 = new int [ ] { 1 , 2 , 3 , 4 , 2 , 3 , 5 , 6 , 4 , 6 , 7 } ; final int [ ] expectedGenKeysForBatchPStmtNoChkODKU51 = new int [ ] { 1 , 2 , 3 , 4 , 2 , 3 , 4 , 3 , 4 , 5 , 5 , 6 , 4 , 5 , 6 , 6 , 7 , 8 , 7 } ; final int [ ] expectedGenKeysForBatchPStmtRW51 = new int [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 } ; do { switch ( ++ testStep ) { case 1 : testConn = getConnectionWithProps ( "" ) ; expectedUpdCount = versionMeetsMinimum ( 5 , 5 ) ? expectedUpdCountDef : expectedUpdCountDef51 ; expectedGenKeys = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForChkODKU : expectedGenKeysForChkODKU51 ; expectedGenKeysBatchStmt = expectedGenKeys ; expectedUpdCountBatchPStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedUpdCountBatchPStmtNoRW : expectedUpdCountBatchPStmtNoRW51 ; expectedGenKeysBatchPStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForBatchPStmtChkODKU : expectedGenKeysForBatchPStmtChkODKU51 ; break ; case 2 : testConn = getConnectionWithProps ( "dontCheckOnDuplicateKeyUpdateInSQL=true" ) ; expectedUpdCount = versionMeetsMinimum ( 5 , 5 ) ? expectedUpdCountDef : expectedUpdCountDef51 ; expectedGenKeys = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForNoChkODKU : expectedGenKeysForNoChkODKU51 ; expectedGenKeysBatchStmt = expectedGenKeys ; expectedUpdCountBatchPStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedUpdCountBatchPStmtNoRW : expectedUpdCountBatchPStmtNoRW51 ; expectedGenKeysBatchPStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForBatchPStmtNoChkODKU : expectedGenKeysForBatchPStmtNoChkODKU51 ; break ; case 3 : testConn = getConnectionWithProps ( "rewriteBatchedStatements=true" ) ; expectedUpdCount = versionMeetsMinimum ( 5 , 5 ) ? expectedUpdCountDef : expectedUpdCountDef51 ; expectedGenKeys = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForChkODKU : expectedGenKeysForChkODKU51 ; expectedGenKeysBatchStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForBatchStmtRW : expectedGenKeysForBatchStmtRW51 ; expectedUpdCountBatchPStmt = expectedUpdCountBatchPStmtRW ; expectedGenKeysBatchPStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForBatchPStmtRW : expectedGenKeysForBatchPStmtRW51 ; break ; case 4 : testConn = getConnectionWithProps ( "rewriteBatchedStatements=true,dontCheckOnDuplicateKeyUpdateInSQL=true" ) ; expectedUpdCount = versionMeetsMinimum ( 5 , 5 ) ? expectedUpdCountDef : expectedUpdCountDef51 ; expectedGenKeys = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForChkODKU : expectedGenKeysForChkODKU51 ; expectedGenKeysBatchStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForBatchStmtRW : expectedGenKeysForBatchStmtRW51 ; expectedUpdCountBatchPStmt = expectedUpdCountBatchPStmtRW ; expectedGenKeysBatchPStmt = versionMeetsMinimum ( 5 , 5 ) ? expectedGenKeysForBatchPStmtRW : expectedGenKeysForBatchPStmtRW51 ; lastTest = true ; break ; } createTable ( "testBug71672" , tableDDL ) ; for ( int i = 0 ; i < queries . length ; i ++ ) { testBug71672Statement ( testStep , testConn , queries [ i ] , - 1 , expectedGenKeys [ i ] ) ; } dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; for ( int i = 0 ; i < queries . length ; i ++ ) { testBug71672Statement ( testStep , testConn , queries [ i ] , expectedUpdCount [ i ] , expectedGenKeys [ i ] ) ; } dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; testStmt = testConn . createStatement ( ) ; for ( String query : queries ) { testStmt . addBatch ( query ) ; } res = testStmt . executeBatch ( ) ; assertEquals ( testStep + ". Satement.executeBatch() result" , expectedUpdCount . length , res . length ) ; for ( int i = 0 ; i < expectedUpdCount . length ; i ++ ) { assertEquals ( testStep + "." + i + ". Satement.executeBatch() result" , expectedUpdCount [ i ] , res [ i ] ) ; } testRS = testStmt . getGeneratedKeys ( ) ; for ( int i = 0 ; i < expectedGenKeysBatchStmt . length ; i ++ ) { for ( int j = 0 ; j < expectedGenKeysBatchStmt [ i ] . length ; j ++ ) { assertTrue ( testStep + ". Row expected in generated keys ResultSet" , testRS . next ( ) ) ; assertEquals ( testStep + ".[" + i + "][" + j + "]. Wrong generated key" , expectedGenKeysBatchStmt [ i ] [ j ] , testRS . getInt ( 1 ) ) ; } } assertFalse ( testStep + ". No more rows expected in generated keys ResultSet" , testRS . next ( ) ) ; testRS . close ( ) ; testStmt . close ( ) ; dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; for ( int i = 0 ; i < queries . length ; i ++ ) { testBug71672PreparedStatement ( testStep , testConn , queries [ i ] , - 1 , expectedGenKeys [ i ] ) ; } dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; for ( int i = 0 ; i < queries . length ; i ++ ) { testBug71672PreparedStatement ( testStep , testConn , queries [ i ] , expectedUpdCount [ i ] , expectedGenKeys [ i ] ) ; } dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; testPStmt = testConn . prepareStatement ( queryBatchPStmt , Statement . RETURN_GENERATED_KEYS ) ; for ( String param : paramsBatchPStmt ) { testPStmt . setString ( 1 , param . substring ( 0 , 1 ) ) ; testPStmt . setInt ( 2 , Integer . parseInt ( param . substring ( 1 ) ) ) ; testPStmt . addBatch ( ) ; } res = testPStmt . executeBatch ( ) ; assertEquals ( testStep + ". PreparedSatement.executeBatch() result" , expectedUpdCountBatchPStmt . length , res . length ) ; for ( int i = 0 ; i < expectedUpdCountBatchPStmt . length ; i ++ ) { assertEquals ( testStep + "." + i + ". PreparedSatement.executeBatch() result" , expectedUpdCountBatchPStmt [ i ] , res [ i ] ) ; } testRS = testPStmt . getGeneratedKeys ( ) ; for ( int i = 0 ; i < expectedGenKeysBatchPStmt . length ; i ++ ) { assertTrue ( testStep + ". Row expected in generated keys ResultSet" , testRS . next ( ) ) ; assertEquals ( testStep + ".[" + i + "]. Wrong generated key" , expectedGenKeysBatchPStmt [ i ] , testRS . getInt ( 1 ) ) ; } assertFalse ( testStep + ". No more rows expected in generated keys ResultSet" , testRS . next ( ) ) ; testRS . close ( ) ; testPStmt . close ( ) ; dropTable ( "testBug71672" ) ; testConn . close ( ) ; } while ( ! lastTest ) ; lastTest = false ; String allQueries = "" ; for ( String q : queries ) { allQueries += q + ";" ; } do { switch ( ++ testStep ) { case 5 : testConn = getConnectionWithProps ( "allowMultiQueries=true" ) ; expectedGenKeysMultiQueries = new int [ ] { 1 } ; break ; case 6 : testConn = getConnectionWithProps ( "allowMultiQueries=true,dontCheckOnDuplicateKeyUpdateInSQL=true" ) ; expectedGenKeysMultiQueries = new int [ ] { 1 , 2 , 3 } ; lastTest = true ; break ; } createTable ( "testBug71672" , tableDDL ) ; testBug71672Statement ( testStep , testConn , allQueries , - 1 , expectedGenKeysMultiQueries ) ; dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; testBug71672Statement ( testStep , testConn , allQueries , 3 , expectedGenKeysMultiQueries ) ; dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; testBug71672PreparedStatement ( testStep , testConn , allQueries , - 1 , expectedGenKeysMultiQueries ) ; dropTable ( "testBug71672" ) ; createTable ( "testBug71672" , tableDDL ) ; testBug71672PreparedStatement ( testStep , testConn , allQueries , 3 , expectedGenKeysMultiQueries ) ; dropTable ( "testBug71672" ) ; testConn . close ( ) ; } while ( ! lastTest ) ; }
tests fix for bug # 71672 - every sql statement is checked if it contains " on duplicate key update " or not
