Skip to content

Commit

Permalink
Added cleanup task to start of every execute. (#2272)
Browse files Browse the repository at this point in the history
* Initial commit. Add the cleanup task to any execute task to clean up on execute.

* Remove added lines in test file

* Remove added imports

* Quick test fix try

* Line should be removed, not just commented out.

* Added missing execute cases

* Discarded count should always be 1

* Mistake revert

* Another try

* Reverted test changes to try to get some consistency
  • Loading branch information
Jeffery-Wasty authored Jan 17, 2024
1 parent 5f71d60 commit 829321f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ public java.sql.ResultSet executeQuery() throws SQLServerException, SQLTimeoutEx
loggerExternal.finer(toString() + ACTIVITY_ID + ActivityCorrelator.getCurrent().toString());
}
checkClosed();
connection.unprepareUnreferencedPreparedStatementHandles(false);
executeStatement(new PrepStmtExecCmd(this, EXECUTE_QUERY));
loggerExternal.exiting(getClassNameLogging(), "executeQuery");
return resultSet;
Expand All @@ -501,6 +502,7 @@ public java.sql.ResultSet executeQuery() throws SQLServerException, SQLTimeoutEx
*/
final java.sql.ResultSet executeQueryInternal() throws SQLServerException, SQLTimeoutException {
checkClosed();
connection.unprepareUnreferencedPreparedStatementHandles(false);
executeStatement(new PrepStmtExecCmd(this, EXECUTE_QUERY_INTERNAL));
return resultSet;
}
Expand All @@ -513,7 +515,7 @@ public int executeUpdate() throws SQLServerException, SQLTimeoutException {
}

checkClosed();

connection.unprepareUnreferencedPreparedStatementHandles(false);
executeStatement(new PrepStmtExecCmd(this, EXECUTE_UPDATE));

// this shouldn't happen, caller probably meant to call executeLargeUpdate
Expand All @@ -534,6 +536,7 @@ public long executeLargeUpdate() throws SQLServerException, SQLTimeoutException
loggerExternal.finer(toString() + ACTIVITY_ID + ActivityCorrelator.getCurrent().toString());
}
checkClosed();
connection.unprepareUnreferencedPreparedStatementHandles(false);
executeStatement(new PrepStmtExecCmd(this, EXECUTE_UPDATE));
loggerExternal.exiting(getClassNameLogging(), "executeLargeUpdate", updateCount);
return updateCount;
Expand All @@ -546,6 +549,7 @@ public boolean execute() throws SQLServerException, SQLTimeoutException {
loggerExternal.finer(toString() + ACTIVITY_ID + ActivityCorrelator.getCurrent().toString());
}
checkClosed();
connection.unprepareUnreferencedPreparedStatementHandles(false);
executeStatement(new PrepStmtExecCmd(this, EXECUTE));
loggerExternal.exiting(getClassNameLogging(), "execute", null != resultSet);
return null != resultSet;
Expand Down Expand Up @@ -2199,6 +2203,7 @@ public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQL
loggerExternal.finer(toString() + ACTIVITY_ID + ActivityCorrelator.getCurrent().toString());
}
checkClosed();
connection.unprepareUnreferencedPreparedStatementHandles(false);
discardLastExecutionResults();

try {
Expand Down Expand Up @@ -2382,6 +2387,7 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio
loggerExternal.finer(toString() + ACTIVITY_ID + ActivityCorrelator.getCurrent().toString());
}
checkClosed();
connection.unprepareUnreferencedPreparedStatementHandles(false);
discardLastExecutionResults();

try {
Expand Down

0 comments on commit 829321f

Please sign in to comment.