Skip to content

Commit 7f3ef8d

Browse files
committed
timeoutOccurred variable is not required at this place
1 parent 5c7c24f commit 7f3ef8d

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,7 +2997,6 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand)
29972997

29982998
int numBatchesPrepared = 0;
29992999
int numBatchesExecuted = 0;
3000-
boolean timeoutOccurred = false; // Flag to track timeout for exec method
30013000
boolean isPrepareMethodExec = connection.getPrepareMethod().equals(PrepareMethod.EXEC.toString());
30023001

30033002
if (isSelect(userSQL)) {
@@ -3021,7 +3020,7 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand)
30213020
Parameter[] batchParam = new Parameter[inOutParam.length];
30223021

30233022
TDSWriter tdsWriter = null;
3024-
while (numBatchesExecuted < numBatches && !timeoutOccurred) {
3023+
while (numBatchesExecuted < numBatches) {
30253024
// Fill in the parameter values for this batch
30263025
Parameter[] paramValues = batchParamValues.get(numBatchesPrepared);
30273026
assert paramValues.length == batchParam.length;
@@ -3189,17 +3188,15 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand)
31893188
String sqlState = batchCommand.batchException.getSQLState();
31903189
if (null != sqlState
31913190
&& sqlState.equals(SQLState.STATEMENT_CANCELED.getSQLStateCode())) {
3192-
timeoutOccurred = true; // Set flag for final cleanup
31933191
processBatch();
31943192
continue;
31953193
}
31963194
}
31973195

31983196
// In batch execution, we have a special update count
31993197
// to indicate that no information was returned
3200-
batchCommand.updateCounts[numBatchesExecuted] = (-1 == updateCount)
3201-
? Statement.SUCCESS_NO_INFO
3202-
: updateCount;
3198+
batchCommand.updateCounts[numBatchesExecuted] = (-1 == updateCount) ? Statement.SUCCESS_NO_INFO
3199+
: updateCount;
32033200

32043201
processBatch();
32053202

@@ -3236,14 +3233,6 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand)
32363233
break;
32373234
}
32383235
}
3239-
3240-
// For exec method timeout handling: mark any remaining unprocessed batches as
3241-
// failed
3242-
if (timeoutOccurred) {
3243-
while (numBatchesExecuted < numBatches) {
3244-
batchCommand.updateCounts[numBatchesExecuted++] = Statement.EXECUTE_FAILED;
3245-
}
3246-
}
32473236
}
32483237

32493238
/**

0 commit comments

Comments
 (0)