Skip to content

Commit b19dfb0

Browse files
committed
Fixes p4
1 parent b0424dd commit b19dfb0

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ void sendByRPC(TDSWriter tdsWriter, SQLServerStatement statement) throws SQLServ
12451245
try {
12461246
inputDTV.sendCryptoMetaData(this.cryptoMeta, tdsWriter);
12471247
inputDTV.setJdbcTypeSetByUser(getJdbcTypeSetByUser(), getValueLength());
1248-
inputDTV.sendByRPC(SQLServerPreparedStatement.callRpcDirectly ? name : null, null, conn.getDatabaseCollation(), valueLength, isOutput() ? outScale : scale,
1248+
inputDTV.sendByRPC(SQLServerPreparedStatement.callRpcDirectly && !conn.isColumnEncryptionSettingEnabled()? name : null, null, conn.getDatabaseCollation(), valueLength, isOutput() ? outScale : scale,
12491249
isOutput(), tdsWriter, statement);
12501250
} finally {
12511251
// reset the cryptoMeta in IOBuffer

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private Parameter getOutParameter(int i) throws SQLServerException {
192192
return inOutParam[i - 1];
193193
}
194194

195-
if (inOutParam[i - 1].isReturnValue() && bReturnValueSyntax && !isCursorable(executeMethod) && !isTVPType) {
195+
if (inOutParam[i - 1].isReturnValue() && bReturnValueSyntax && !isCursorable(executeMethod) && !isTVPType && !connection.isColumnEncryptionSettingEnabled()) {
196196
return inOutParam[i - 1];
197197
}
198198

@@ -341,7 +341,7 @@ boolean onRetValue(TDSReader tdsReader) throws SQLServerException {
341341
OutParamHandler outParamHandler = new OutParamHandler();
342342

343343
if (bReturnValueSyntax && (nOutParamsAssigned == 0) && !isCursorable(executeMethod) && !isTVPType
344-
&& SQLServerConnection.isCallRemoteProcDirectValid(userSQL, inOutParam.length, bReturnValueSyntax)) {
344+
&& SQLServerConnection.isCallRemoteProcDirectValid(userSQL, inOutParam.length, bReturnValueSyntax) && !connection.isColumnEncryptionSettingEnabled()) {
345345
nOutParamsAssigned++;
346346
}
347347

@@ -389,7 +389,7 @@ boolean onRetValue(TDSReader tdsReader) throws SQLServerException {
389389
outParamIndex = outParamHandler.srv.getOrdinalOrLength();
390390

391391
if (bReturnValueSyntax && !isCursorable(executeMethod) && !isTVPType && SQLServerConnection
392-
.isCallRemoteProcDirectValid(userSQL, inOutParam.length, bReturnValueSyntax)) {
392+
.isCallRemoteProcDirectValid(userSQL, inOutParam.length, bReturnValueSyntax) && !connection.isColumnEncryptionSettingEnabled()) {
393393
outParamIndex++;
394394
} else {
395395
// Statements need to have their out param indices adjusted by the number

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,10 @@ void sendParamsByRPC(TDSWriter tdsWriter, Parameter[] params, boolean bReturnVal
764764
&& SQLServerConnection.isCallRemoteProcDirectValid(userSQL, params.length, bReturnValueSyntax)) {
765765
returnParam = params[index];
766766
params[index].setReturnValue(true);
767-
index++;
767+
768+
if (!connection.isColumnEncryptionSettingEnabled()) {
769+
index++;
770+
}
768771
}
769772
for (; index < params.length; index++) {
770773
if (JDBCType.TVP == params[index].getJdbcType()) {
@@ -1164,7 +1167,7 @@ private boolean doPrepExec(TDSWriter tdsWriter, Parameter[] params, boolean hasN
11641167
buildServerCursorExecParams(tdsWriter);
11651168
} else {
11661169
// if it is a parameterized stored procedure call and is not TVP, use sp_execute directly.
1167-
if (needsPrepare && callRpcDirectly) {
1170+
if (needsPrepare && callRpcDirectly && !connection.isColumnEncryptionSettingEnabled()) {
11681171
buildRPCExecParams(tdsWriter);
11691172
}
11701173
// Move overhead of needing to do prepare & unprepare to only use cases that need more than one execution.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ boolean onRetStatus(TDSReader tdsReader) throws SQLServerException {
16161616
// not cursorable and not TVP type. For these two, the driver is still following the old behavior of
16171617
// executing sp_executesql for stored procedures.
16181618
if (!isCursorable(executeMethod) && !SQLServerPreparedStatement.isTVPType && null != inOutParam
1619-
&& inOutParam.length > 0 && inOutParam[0].isReturnValue()) {
1619+
&& inOutParam.length > 0 && inOutParam[0].isReturnValue() && !connection.isColumnEncryptionSettingEnabled()) {
16201620
inOutParam[0].setFromReturnStatus(procedureRetStatToken.getStatus(), connection);
16211621
return false;
16221622
}

0 commit comments

Comments
 (0)