instead of checking the first parameter, using a flag
@@ -90,6 +90,11 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
/** Flag set to true when statement execution is expected to return the prepared statement handle */
private boolean expectPrepStmtHandle = false;
+ /**
+ * Flag set to true when all encryption metadata of inOutParam is retrieved
+ */
+ private boolean encryptionMetadataISRetrieved = false;
+
// Internal function used in tracing
String getClassNameInternal() {
return "SQLServerPreparedStatement";
@@ -202,6 +207,7 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
* @param sql
*/
/* L0 */ final void initParams(String sql) {
+ encryptionMetadataISRetrieved = false;
int nParams = 0;
// Figure out the expected number of parameters by counting the
@@ -219,6 +225,7 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
/* L0 */ public final void clearParameters() throws SQLServerException {
loggerExternal.entering(getClassNameLogging(), "clearParameters");
checkClosed();
+ encryptionMetadataISRetrieved = false;
int i;
if (inOutParam == null)
return;
@@ -417,8 +424,9 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
if ((Util.shouldHonorAEForParameters(stmtColumnEncriptionSetting, connection)) && (0 < inOutParam.length) && !isInternalEncryptionQuery) {
// retrieve paramater encryption metadata if they are not retrieved yet
- if (null == inOutParam[0].getCryptoMetadata()) {
+ if (!encryptionMetadataISRetrieved) {
getParameterEncryptionMetadata(inOutParam);
+ encryptionMetadataISRetrieved = true;
}
// maxRows is set to 0 when retreving encryption metadata,
