Skip to content

Commit fe403ff

Browse files
authored
Port SqlParameter changes from netcore to netfx (#1812)
1 parent c6821c3 commit fe403ff

File tree

4 files changed

+244
-248
lines changed

4 files changed

+244
-248
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -4058,6 +4058,7 @@ private void PrepareDescribeParameterEncryptionRequest(_SqlRPC originalRpcReques
40584058
tsqlParam.SqlDbType = ((text.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
40594059
tsqlParam.Value = text;
40604060
tsqlParam.Size = text.Length;
4061+
tsqlParam.Direction = ParameterDirection.Input;
40614062
}
40624063
else
40634064
{
@@ -4075,6 +4076,7 @@ private void PrepareDescribeParameterEncryptionRequest(_SqlRPC originalRpcReques
40754076
tsqlParam.SqlDbType = ((text.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
40764077
tsqlParam.Value = text;
40774078
tsqlParam.Size = text.Length;
4079+
tsqlParam.Direction = ParameterDirection.Input;
40784080
}
40794081
}
40804082

@@ -4151,13 +4153,15 @@ private void PrepareDescribeParameterEncryptionRequest(_SqlRPC originalRpcReques
41514153
paramsParam.SqlDbType = ((parameterList.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
41524154
paramsParam.Size = parameterList.Length;
41534155
paramsParam.Value = parameterList;
4156+
paramsParam.Direction = ParameterDirection.Input;
41544157

41554158
if (attestationParameters != null)
41564159
{
41574160
SqlParameter attestationParametersParam = describeParameterEncryptionRequest.systemParams[2];
4158-
attestationParametersParam.Direction = ParameterDirection.Input;
4161+
attestationParametersParam.SqlDbType = SqlDbType.VarBinary;
41594162
attestationParametersParam.Size = attestationParameters.Length;
41604163
attestationParametersParam.Value = attestationParameters;
4164+
attestationParametersParam.Direction = ParameterDirection.Input;
41614165
}
41624166
}
41634167

@@ -5791,13 +5795,15 @@ private _SqlRPC BuildPrepExec(CommandBehavior behavior)
57915795
sqlParam.SqlDbType = ((paramList.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
57925796
sqlParam.Value = paramList;
57935797
sqlParam.Size = paramList.Length;
5798+
sqlParam.Direction = ParameterDirection.Input;
57945799

57955800
//@batch_text
57965801
string text = GetCommandText(behavior);
57975802
sqlParam = rpc.systemParams[2];
57985803
sqlParam.SqlDbType = ((text.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
57995804
sqlParam.Size = text.Length;
58005805
sqlParam.Value = text;
5806+
sqlParam.Direction = ParameterDirection.Input;
58015807

58025808
SetUpRPCParameters(rpc, false, _parameters);
58035809
return rpc;
@@ -5899,6 +5905,7 @@ private _SqlRPC BuildExecute(bool inSchema)
58995905
//@handle
59005906
SqlParameter sqlParam = rpc.systemParams[0];
59015907
sqlParam.SqlDbType = SqlDbType.Int;
5908+
sqlParam.Size = 4;
59025909
sqlParam.Value = _prepareHandle;
59035910
sqlParam.Direction = ParameterDirection.Input;
59045911

@@ -5951,6 +5958,7 @@ private void BuildExecuteSql(CommandBehavior behavior, string commandText, SqlPa
59515958
sqlParam.SqlDbType = ((paramList.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
59525959
sqlParam.Size = paramList.Length;
59535960
sqlParam.Value = paramList;
5961+
sqlParam.Direction = ParameterDirection.Input;
59545962

59555963
bool inSchema = (0 != (behavior & CommandBehavior.SchemaOnly));
59565964
SetUpRPCParameters(rpc, inSchema, parameters);

0 commit comments

Comments
 (0)