fix hasPreparedStatementHandle()
@@ -496,7 +496,6 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
resetForReexecute();
definitionChanged = false;
- String cacahedPreparedTypeDefinitions = preparedTypeDefinitions;
// If this request might be a query (as opposed to an update) then make
// sure we set the max number of rows and max field size for any ResultSet
@@ -536,11 +535,6 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
hasNewTypeDefinitions = buildPreparedStrings(inOutParam, true);
}
- if (cacahedPreparedTypeDefinitions != null && cacahedPreparedTypeDefinitions.equals(preparedTypeDefinitions)) {
- definitionChanged = true;
- cacahedPreparedTypeDefinitions = preparedTypeDefinitions;
- }
-
if (reuseCachedHandle(hasNewTypeDefinitions, false)) {
hasNewTypeDefinitions = false;
}
@@ -912,6 +906,7 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
/** Manage re-using cached handles */
private boolean reuseCachedHandle(boolean hasNewTypeDefinitions, boolean discardCurrentCacheItem) {
if (definitionChanged) {
+ prepStmtHandle = -1; // so that hasPreparedStatementHandle() also returns false
return false;
}
@@ -2564,7 +2559,6 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
Parameter[] batchParam = new Parameter[inOutParam.length];
definitionChanged = false;
- String cacahedPreparedTypeDefinitions = preparedTypeDefinitions;
TDSWriter tdsWriter = null;
while (numBatchesExecuted < numBatches) {
@@ -2590,11 +2584,6 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
}
}
- if (cacahedPreparedTypeDefinitions != null && cacahedPreparedTypeDefinitions.equals(preparedTypeDefinitions)) {
- definitionChanged = true;
- cacahedPreparedTypeDefinitions = preparedTypeDefinitions;
- }
-
// Update the crypto metadata for this batch.
if (0 < numBatchesExecuted) {
// cryptoMetaBatch will be empty for non-AE connections/statements.
