only call buildPreparedStrings for the first prepared statewment
@@ -420,14 +420,17 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
loggerExternal.finer(toString() + " ActivityId: " + ActivityCorrelator.getNext().toString());
}
- boolean hasNewTypeDefinitions = buildPreparedStrings(inOutParam, false);
+ boolean hasNewTypeDefinitions = true;
+ if (!encryptionMetadataIsRetrieved) {
+ hasNewTypeDefinitions = buildPreparedStrings(inOutParam, false);
+ }
+
if ((Util.shouldHonorAEForParameters(stmtColumnEncriptionSetting, connection)) && (0 < inOutParam.length) && !isInternalEncryptionQuery) {
// retrieve paramater encryption metadata if they are not retrieved yet
if (!encryptionMetadataIsRetrieved) {
getParameterEncryptionMetadata(inOutParam);
encryptionMetadataIsRetrieved = true;
- }
// maxRows is set to 0 when retreving encryption metadata,
// need to set it back
@@ -436,6 +439,7 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
// fix an issue when inserting unicode into non-encrypted nchar column using setString() and AE is on on Connection
buildPreparedStrings(inOutParam, true);
}
+ }
// Start the request and detach the response reader so that we can
// continue using it after we return.
