@@ -72,7 +72,7 @@ internal sealed class ExecuteNonQueryAsyncCallContext : AAsyncCallContext<SqlCom
72
72
73
73
public TaskCompletionSource < int > TaskCompletionSource => _source ;
74
74
75
- public void Set ( SqlCommand command , TaskCompletionSource < int > source , CancellationTokenRegistration disposable , Guid operationID )
75
+ public void Set ( SqlCommand command , TaskCompletionSource < int > source , CancellationTokenRegistration disposable , Guid operationID )
76
76
{
77
77
base . Set ( command , source , disposable ) ;
78
78
OperationID = operationID ;
@@ -250,9 +250,9 @@ internal bool IsColumnEncryptionEnabled
250
250
}
251
251
}
252
252
253
- internal bool ShouldUseEnclaveBasedWorkflow =>
254
- ( ! string . IsNullOrWhiteSpace ( _activeConnection . EnclaveAttestationUrl ) || Connection . AttestationProtocol == SqlConnectionAttestationProtocol . None ) &&
255
- IsColumnEncryptionEnabled ;
253
+ internal bool ShouldUseEnclaveBasedWorkflow =>
254
+ ( ! string . IsNullOrWhiteSpace ( _activeConnection . EnclaveAttestationUrl ) || Connection . AttestationProtocol == SqlConnectionAttestationProtocol . None ) &&
255
+ IsColumnEncryptionEnabled ;
256
256
257
257
/// <summary>
258
258
/// Per-command custom providers. It can be provided by the user and can be set more than once.
@@ -1319,13 +1319,13 @@ private IAsyncResult BeginExecuteNonQueryInternal(CommandBehavior behavior, Asyn
1319
1319
// In these cases finalize the call internally and trigger a retry when needed.
1320
1320
if (
1321
1321
! TriggerInternalEndAndRetryIfNecessary (
1322
- behavior ,
1323
- stateObject ,
1324
- timeout ,
1325
- usedCache ,
1326
- inRetry ,
1327
- asyncWrite ,
1328
- globalCompletion ,
1322
+ behavior ,
1323
+ stateObject ,
1324
+ timeout ,
1325
+ usedCache ,
1326
+ inRetry ,
1327
+ asyncWrite ,
1328
+ globalCompletion ,
1329
1329
localCompletion ,
1330
1330
endFunc : static ( SqlCommand command , IAsyncResult asyncResult , bool isInternal , string endMethod ) =>
1331
1331
{
@@ -1607,9 +1607,9 @@ private object InternalEndExecuteNonQuery(IAsyncResult asyncResult, bool isInter
1607
1607
{
1608
1608
bool dataReady ;
1609
1609
Debug . Assert ( _stateObj . _syncOverAsync , "Should not attempt pends in a synchronous call" ) ;
1610
- bool result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , null , null , _stateObj ,
1610
+ TdsOperationStatus result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , null , null , _stateObj ,
1611
1611
out dataReady ) ;
1612
- if ( ! result )
1612
+ if ( result != TdsOperationStatus . Done )
1613
1613
{
1614
1614
throw SQL . SynchronousCallMayNotPend ( ) ;
1615
1615
}
@@ -1849,13 +1849,13 @@ private IAsyncResult BeginExecuteXmlReaderInternal(CommandBehavior behavior, Asy
1849
1849
// In these cases finalize the call internally and trigger a retry when needed.
1850
1850
if (
1851
1851
! TriggerInternalEndAndRetryIfNecessary (
1852
- behavior ,
1853
- stateObject ,
1854
- timeout ,
1855
- usedCache ,
1856
- inRetry ,
1857
- asyncWrite ,
1858
- globalCompletion ,
1852
+ behavior ,
1853
+ stateObject ,
1854
+ timeout ,
1855
+ usedCache ,
1856
+ inRetry ,
1857
+ asyncWrite ,
1858
+ globalCompletion ,
1859
1859
localCompletion ,
1860
1860
endFunc : static ( SqlCommand command , IAsyncResult asyncResult , bool isInternal , string endMethod ) =>
1861
1861
{
@@ -2295,13 +2295,13 @@ private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncC
2295
2295
// In these cases finalize the call internally and trigger a retry when needed.
2296
2296
if (
2297
2297
! TriggerInternalEndAndRetryIfNecessary (
2298
- behavior ,
2299
- stateObject ,
2300
- timeout ,
2301
- usedCache ,
2302
- inRetry ,
2303
- asyncWrite ,
2304
- globalCompletion ,
2298
+ behavior ,
2299
+ stateObject ,
2300
+ timeout ,
2301
+ usedCache ,
2302
+ inRetry ,
2303
+ asyncWrite ,
2304
+ globalCompletion ,
2305
2305
localCompletion ,
2306
2306
endFunc : static ( SqlCommand command , IAsyncResult asyncResult , bool isInternal , string endMethod ) =>
2307
2307
{
@@ -2898,7 +2898,7 @@ private Task<object> InternalExecuteScalarAsync(CancellationToken cancellationTo
2898
2898
// exception thrown by Dispose...
2899
2899
source . SetException ( e ) ;
2900
2900
}
2901
- } ,
2901
+ } ,
2902
2902
TaskScheduler . Default
2903
2903
) ;
2904
2904
}
@@ -2972,7 +2972,7 @@ internal Task<object> ExecuteScalarBatchAsync(CancellationToken cancellationToke
2972
2972
// exception thrown by Dispose...
2973
2973
source . SetException ( e ) ;
2974
2974
}
2975
- } ,
2975
+ } ,
2976
2976
TaskScheduler . Default
2977
2977
) ;
2978
2978
}
@@ -3682,9 +3682,11 @@ private Task RunExecuteNonQueryTds(string methodName, bool isAsync, int timeout,
3682
3682
{
3683
3683
bool dataReady ;
3684
3684
Debug . Assert ( _stateObj . _syncOverAsync , "Should not attempt pends in a synchronous call" ) ;
3685
- bool result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , null , null , _stateObj , out dataReady ) ;
3686
- if ( ! result )
3687
- { throw SQL . SynchronousCallMayNotPend ( ) ; }
3685
+ TdsOperationStatus result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , null , null , _stateObj , out dataReady ) ;
3686
+ if ( result != TdsOperationStatus . Done )
3687
+ {
3688
+ throw SQL . SynchronousCallMayNotPend ( ) ;
3689
+ }
3688
3690
}
3689
3691
}
3690
3692
catch ( Exception e )
@@ -4589,7 +4591,7 @@ private void ReadDescribeEncryptionParameterResults(SqlDataReader ds, ReadOnlyDi
4589
4591
SqlParameter sqlParameter = rpc . userParams [ index ] ;
4590
4592
Debug . Assert ( sqlParameter != null , "sqlParameter should not be null." ) ;
4591
4593
4592
- if ( SqlParameter . ParameterNamesEqual ( sqlParameter . ParameterName , parameterName , StringComparison . Ordinal ) )
4594
+ if ( SqlParameter . ParameterNamesEqual ( sqlParameter . ParameterName , parameterName , StringComparison . Ordinal ) )
4593
4595
{
4594
4596
Debug . Assert ( sqlParameter . CipherMetadata == null , "param.CipherMetadata should be null." ) ;
4595
4597
sqlParameter . HasReceivedMetadata = true ;
@@ -4920,7 +4922,7 @@ private void GenerateEnclavePackage()
4920
4922
return ;
4921
4923
}
4922
4924
4923
- if ( string . IsNullOrWhiteSpace ( this . _activeConnection . EnclaveAttestationUrl ) &&
4925
+ if ( string . IsNullOrWhiteSpace ( this . _activeConnection . EnclaveAttestationUrl ) &&
4924
4926
Connection . AttestationProtocol != SqlConnectionAttestationProtocol . None )
4925
4927
{
4926
4928
throw SQL . NoAttestationUrlSpecifiedForEnclaveBasedQueryGeneratingEnclavePackage ( this . _activeConnection . Parser . EnclaveType ) ;
@@ -5136,9 +5138,11 @@ private SqlDataReader RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavi
5136
5138
Task executeTask = _stateObj . Parser . TdsExecuteSQLBatch ( optionSettings , timeout , this . Notification , _stateObj , sync : true ) ;
5137
5139
Debug . Assert ( executeTask == null , "Shouldn't get a task when doing sync writes" ) ;
5138
5140
Debug . Assert ( _stateObj . _syncOverAsync , "Should not attempt pends in a synchronous call" ) ;
5139
- bool result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , null , null , _stateObj , out bool dataReady ) ;
5140
- if ( ! result )
5141
- { throw SQL . SynchronousCallMayNotPend ( ) ; }
5141
+ TdsOperationStatus result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , null , null , _stateObj , out bool dataReady ) ;
5142
+ if ( result != TdsOperationStatus . Done )
5143
+ {
5144
+ throw SQL . SynchronousCallMayNotPend ( ) ;
5145
+ }
5142
5146
// and turn OFF when the ds exhausts the stream on Close()
5143
5147
optionSettings = GetResetOptionsString ( cmdBehavior ) ;
5144
5148
}
@@ -5296,9 +5300,11 @@ private void FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, stri
5296
5300
{
5297
5301
bool dataReady ;
5298
5302
Debug . Assert ( _stateObj . _syncOverAsync , "Should not attempt pends in a synchronous call" ) ;
5299
- bool result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , ds , null , _stateObj , out dataReady ) ;
5300
- if ( ! result )
5301
- { throw SQL . SynchronousCallMayNotPend ( ) ; }
5303
+ TdsOperationStatus result = _stateObj . Parser . TryRun ( RunBehavior . UntilDone , this , ds , null , _stateObj , out dataReady ) ;
5304
+ if ( result != TdsOperationStatus . Done )
5305
+ {
5306
+ throw SQL . SynchronousCallMayNotPend ( ) ;
5307
+ }
5302
5308
}
5303
5309
catch ( Exception e )
5304
5310
{
@@ -5869,9 +5875,9 @@ private SqlParameter GetParameterForOutputValueExtraction(SqlParameterCollection
5869
5875
thisParam = parameters [ i ] ;
5870
5876
// searching for Output or InputOutput or ReturnValue with matching name
5871
5877
if (
5872
- thisParam . Direction != ParameterDirection . Input &&
5873
- thisParam . Direction != ParameterDirection . ReturnValue &&
5874
- SqlParameter . ParameterNamesEqual ( paramName , thisParam . ParameterName , StringComparison . Ordinal )
5878
+ thisParam . Direction != ParameterDirection . Input &&
5879
+ thisParam . Direction != ParameterDirection . ReturnValue &&
5880
+ SqlParameter . ParameterNamesEqual ( paramName , thisParam . ParameterName , StringComparison . Ordinal )
5875
5881
)
5876
5882
{
5877
5883
foundParam = true ;
0 commit comments