From f653891e50a9b3f3ac149ad61bf8f996c563134d Mon Sep 17 00:00:00 2001 From: Terry <32403408+tkyc@users.noreply.github.com> Date: Tue, 3 Jan 2023 14:03:38 -0800 Subject: [PATCH] Fixed update count tests (#2033) --- .../unit/statement/BatchExecutionTest.java | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java index b8e1e0b41..208d6c01b 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java @@ -63,7 +63,7 @@ public class BatchExecutionTest extends AbstractTest { @Test public void testBatchUpdateCountFalseOnFirstPstmtPrepexec() throws Exception { long[] expectedUpdateCount = {1, 1, 1, 1, -3, -3, -3, -3, -3, -3}; - testBatchUpdateCountWith(10, 6, false, "prepexec", expectedUpdateCount); + testBatchUpdateCountWith(10, 6, false, expectedUpdateCount); } /** @@ -74,29 +74,7 @@ public void testBatchUpdateCountFalseOnFirstPstmtPrepexec() throws Exception { @Test public void testBatchUpdateCountTrueOnFirstPstmtPrepexec() throws Exception { long[] expectedUpdateCount = {1, 1, -3, -3, -3}; - testBatchUpdateCountWith(5, 4, true, "prepexec", expectedUpdateCount); - } - - /** - * This tests the updateCount when the error query does cause a SQL state HY008. - * - * @throws Exception - */ - @Test - public void testBatchUpdateCountFalseOnFirstPstmtSpPrepare() throws Exception { - long[] expectedUpdateCount = {1, 1, 1, 1, -3, -3, -3, -3, -3, -3}; - testBatchUpdateCountWith(10, 6, false, "prepare", expectedUpdateCount); - } - - /** - * This tests the updateCount when the error query does cause a SQL state HY008. - * - * @throws Exception - */ - @Test - public void testBatchUpdateCountTrueOnFirstPstmtSpPrepare() throws Exception { - long[] expectedUpdateCount = {1, 1, -3, -3, -3}; - testBatchUpdateCountWith(5, 4, true, "prepare", expectedUpdateCount); + testBatchUpdateCountWith(5, 4, true, expectedUpdateCount); } /** @@ -214,11 +192,9 @@ public void testExecuteBatch1UseBulkCopyAPI() { } private void testBatchUpdateCountWith(int numOfInserts, int errorQueryIndex, - boolean prepareOnFirstPreparedStatement, String prepareMethod, - long[] expectedUpdateCount) throws Exception { + boolean prepareOnFirstPreparedStatement, long[] expectedUpdateCount) throws Exception { try (SQLServerConnection connection = PrepUtil.getConnection(connectionString)) { connection.setEnablePrepareOnFirstPreparedStatementCall(prepareOnFirstPreparedStatement); - connection.setPrepareMethod(prepareMethod); try (CallableStatement cstmt = connection.prepareCall( AbstractSQLGenerator.escapeIdentifier(ctstable3Procedure1) + " @duration=?, @value=?")) { cstmt.setQueryTimeout(7);