Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ internal sealed class ExecuteNonQueryAsyncCallContext : AAsyncCallContext<SqlCom

public TaskCompletionSource<int> TaskCompletionSource => _source;

public void Set(SqlCommand command, TaskCompletionSource<int> source, CancellationTokenRegistration disposable, Guid operationID)
public void Set(SqlCommand command, TaskCompletionSource<int> source, CancellationTokenRegistration disposable, Guid operationID)
{
base.Set(command, source, disposable);
OperationID = operationID;
Expand Down Expand Up @@ -250,9 +250,9 @@ internal bool IsColumnEncryptionEnabled
}
}

internal bool ShouldUseEnclaveBasedWorkflow =>
(!string.IsNullOrWhiteSpace(_activeConnection.EnclaveAttestationUrl) || Connection.AttestationProtocol == SqlConnectionAttestationProtocol.None) &&
IsColumnEncryptionEnabled;
internal bool ShouldUseEnclaveBasedWorkflow =>
(!string.IsNullOrWhiteSpace(_activeConnection.EnclaveAttestationUrl) || Connection.AttestationProtocol == SqlConnectionAttestationProtocol.None) &&
IsColumnEncryptionEnabled;

/// <summary>
/// Per-command custom providers. It can be provided by the user and can be set more than once.
Expand Down Expand Up @@ -1319,13 +1319,13 @@ private IAsyncResult BeginExecuteNonQueryInternal(CommandBehavior behavior, Asyn
// In these cases finalize the call internally and trigger a retry when needed.
if (
!TriggerInternalEndAndRetryIfNecessary(
behavior,
stateObject,
timeout,
usedCache,
inRetry,
asyncWrite,
globalCompletion,
behavior,
stateObject,
timeout,
usedCache,
inRetry,
asyncWrite,
globalCompletion,
localCompletion,
endFunc: static (SqlCommand command, IAsyncResult asyncResult, bool isInternal, string endMethod) =>
{
Expand Down Expand Up @@ -1607,9 +1607,9 @@ private object InternalEndExecuteNonQuery(IAsyncResult asyncResult, bool isInter
{
bool dataReady;
Debug.Assert(_stateObj._syncOverAsync, "Should not attempt pends in a synchronous call");
bool result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, null, null, _stateObj,
TdsOperationStatus result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, null, null, _stateObj,
out dataReady);
if (!result)
if (result != TdsOperationStatus.Done)
{
throw SQL.SynchronousCallMayNotPend();
}
Expand Down Expand Up @@ -1849,13 +1849,13 @@ private IAsyncResult BeginExecuteXmlReaderInternal(CommandBehavior behavior, Asy
// In these cases finalize the call internally and trigger a retry when needed.
if (
!TriggerInternalEndAndRetryIfNecessary(
behavior,
stateObject,
timeout,
usedCache,
inRetry,
asyncWrite,
globalCompletion,
behavior,
stateObject,
timeout,
usedCache,
inRetry,
asyncWrite,
globalCompletion,
localCompletion,
endFunc: static (SqlCommand command, IAsyncResult asyncResult, bool isInternal, string endMethod) =>
{
Expand Down Expand Up @@ -2295,13 +2295,13 @@ private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncC
// In these cases finalize the call internally and trigger a retry when needed.
if (
!TriggerInternalEndAndRetryIfNecessary(
behavior,
stateObject,
timeout,
usedCache,
inRetry,
asyncWrite,
globalCompletion,
behavior,
stateObject,
timeout,
usedCache,
inRetry,
asyncWrite,
globalCompletion,
localCompletion,
endFunc: static (SqlCommand command, IAsyncResult asyncResult, bool isInternal, string endMethod) =>
{
Expand Down Expand Up @@ -2898,7 +2898,7 @@ private Task<object> InternalExecuteScalarAsync(CancellationToken cancellationTo
// exception thrown by Dispose...
source.SetException(e);
}
},
},
TaskScheduler.Default
);
}
Expand Down Expand Up @@ -2972,7 +2972,7 @@ internal Task<object> ExecuteScalarBatchAsync(CancellationToken cancellationToke
// exception thrown by Dispose...
source.SetException(e);
}
},
},
TaskScheduler.Default
);
}
Expand Down Expand Up @@ -3682,9 +3682,11 @@ private Task RunExecuteNonQueryTds(string methodName, bool isAsync, int timeout,
{
bool dataReady;
Debug.Assert(_stateObj._syncOverAsync, "Should not attempt pends in a synchronous call");
bool result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, null, null, _stateObj, out dataReady);
if (!result)
{ throw SQL.SynchronousCallMayNotPend(); }
TdsOperationStatus result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, null, null, _stateObj, out dataReady);
if (result != TdsOperationStatus.Done)
{
throw SQL.SynchronousCallMayNotPend();
}
}
}
catch (Exception e)
Expand Down Expand Up @@ -4589,7 +4591,7 @@ private void ReadDescribeEncryptionParameterResults(SqlDataReader ds, ReadOnlyDi
SqlParameter sqlParameter = rpc.userParams[index];
Debug.Assert(sqlParameter != null, "sqlParameter should not be null.");

if (SqlParameter.ParameterNamesEqual(sqlParameter.ParameterName,parameterName,StringComparison.Ordinal))
if (SqlParameter.ParameterNamesEqual(sqlParameter.ParameterName, parameterName, StringComparison.Ordinal))
{
Debug.Assert(sqlParameter.CipherMetadata == null, "param.CipherMetadata should be null.");
sqlParameter.HasReceivedMetadata = true;
Expand Down Expand Up @@ -4920,7 +4922,7 @@ private void GenerateEnclavePackage()
return;
}

if (string.IsNullOrWhiteSpace(this._activeConnection.EnclaveAttestationUrl) &&
if (string.IsNullOrWhiteSpace(this._activeConnection.EnclaveAttestationUrl) &&
Connection.AttestationProtocol != SqlConnectionAttestationProtocol.None)
{
throw SQL.NoAttestationUrlSpecifiedForEnclaveBasedQueryGeneratingEnclavePackage(this._activeConnection.Parser.EnclaveType);
Expand Down Expand Up @@ -5136,9 +5138,11 @@ private SqlDataReader RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavi
Task executeTask = _stateObj.Parser.TdsExecuteSQLBatch(optionSettings, timeout, this.Notification, _stateObj, sync: true);
Debug.Assert(executeTask == null, "Shouldn't get a task when doing sync writes");
Debug.Assert(_stateObj._syncOverAsync, "Should not attempt pends in a synchronous call");
bool result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, null, null, _stateObj, out bool dataReady);
if (!result)
{ throw SQL.SynchronousCallMayNotPend(); }
TdsOperationStatus result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, null, null, _stateObj, out bool dataReady);
if (result != TdsOperationStatus.Done)
{
throw SQL.SynchronousCallMayNotPend();
}
// and turn OFF when the ds exhausts the stream on Close()
optionSettings = GetResetOptionsString(cmdBehavior);
}
Expand Down Expand Up @@ -5296,9 +5300,11 @@ private void FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, stri
{
bool dataReady;
Debug.Assert(_stateObj._syncOverAsync, "Should not attempt pends in a synchronous call");
bool result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, ds, null, _stateObj, out dataReady);
if (!result)
{ throw SQL.SynchronousCallMayNotPend(); }
TdsOperationStatus result = _stateObj.Parser.TryRun(RunBehavior.UntilDone, this, ds, null, _stateObj, out dataReady);
if (result != TdsOperationStatus.Done)
{
throw SQL.SynchronousCallMayNotPend();
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -5869,9 +5875,9 @@ private SqlParameter GetParameterForOutputValueExtraction(SqlParameterCollection
thisParam = parameters[i];
// searching for Output or InputOutput or ReturnValue with matching name
if (
thisParam.Direction != ParameterDirection.Input &&
thisParam.Direction != ParameterDirection.ReturnValue &&
SqlParameter.ParameterNamesEqual(paramName, thisParam.ParameterName,StringComparison.Ordinal)
thisParam.Direction != ParameterDirection.Input &&
thisParam.Direction != ParameterDirection.ReturnValue &&
SqlParameter.ParameterNamesEqual(paramName, thisParam.ParameterName, StringComparison.Ordinal)
)
{
foundParam = true;
Expand Down
Loading