Skip to content

Commit

Permalink
Port SqlParameter changes from netcore to netfx (#1812)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wraith2 authored Nov 2, 2022
1 parent c6821c3 commit fe403ff
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 248 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4058,6 +4058,7 @@ private void PrepareDescribeParameterEncryptionRequest(_SqlRPC originalRpcReques
tsqlParam.SqlDbType = ((text.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
tsqlParam.Value = text;
tsqlParam.Size = text.Length;
tsqlParam.Direction = ParameterDirection.Input;
}
else
{
Expand All @@ -4075,6 +4076,7 @@ private void PrepareDescribeParameterEncryptionRequest(_SqlRPC originalRpcReques
tsqlParam.SqlDbType = ((text.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
tsqlParam.Value = text;
tsqlParam.Size = text.Length;
tsqlParam.Direction = ParameterDirection.Input;
}
}

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

if (attestationParameters != null)
{
SqlParameter attestationParametersParam = describeParameterEncryptionRequest.systemParams[2];
attestationParametersParam.Direction = ParameterDirection.Input;
attestationParametersParam.SqlDbType = SqlDbType.VarBinary;
attestationParametersParam.Size = attestationParameters.Length;
attestationParametersParam.Value = attestationParameters;
attestationParametersParam.Direction = ParameterDirection.Input;
}
}

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

//@batch_text
string text = GetCommandText(behavior);
sqlParam = rpc.systemParams[2];
sqlParam.SqlDbType = ((text.Length << 1) <= TdsEnums.TYPE_SIZE_LIMIT) ? SqlDbType.NVarChar : SqlDbType.NText;
sqlParam.Size = text.Length;
sqlParam.Value = text;
sqlParam.Direction = ParameterDirection.Input;

SetUpRPCParameters(rpc, false, _parameters);
return rpc;
Expand Down Expand Up @@ -5899,6 +5905,7 @@ private _SqlRPC BuildExecute(bool inSchema)
//@handle
SqlParameter sqlParam = rpc.systemParams[0];
sqlParam.SqlDbType = SqlDbType.Int;
sqlParam.Size = 4;
sqlParam.Value = _prepareHandle;
sqlParam.Direction = ParameterDirection.Input;

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

bool inSchema = (0 != (behavior & CommandBehavior.SchemaOnly));
SetUpRPCParameters(rpc, inSchema, parameters);
Expand Down
Loading

0 comments on commit fe403ff

Please sign in to comment.