@@ -76,10 +76,6 @@ internal class SharedState
76
76
private static int s_objectTypeCount ; // EventSource Counter
77
77
internal readonly int ObjectID = Interlocked . Increment ( ref s_objectTypeCount ) ;
78
78
79
- // context
80
- // undone: we may still want to do this...it's nice to pass in an lpvoid (essentially) and just have the reader keep the state
81
- // private object _context = null; // this is never looked at by the stream object. It is used by upper layers who wish
82
- // to remain stateless
83
79
84
80
// metadata (no explicit table, use 'Table')
85
81
private MultiPartTableName [ ] _tableNames = null ;
@@ -353,7 +349,7 @@ internal virtual SmiExtendedMetaData[] GetInternalSmiMetaData()
353
349
}
354
350
else if ( SqlDbType . Udt == colMetaData . type )
355
351
{
356
- Connection . CheckGetExtendedUDTInfo ( colMetaData , true ) ; // SQLBUDT #370593 ensure that colMetaData.udtType is set
352
+ Connection . CheckGetExtendedUDTInfo ( colMetaData , true ) ; // Ensure that colMetaData.udtType is set
357
353
358
354
typeSpecificNamePart1 = colMetaData . udt ? . DatabaseName ;
359
355
typeSpecificNamePart2 = colMetaData . udt ? . SchemaName ;
@@ -500,9 +496,6 @@ internal void Bind(TdsParserStateObject stateObj)
500
496
_defaultLCID = _parser . DefaultLCID ;
501
497
}
502
498
503
- // Fills in a schema table with meta data information. This function should only really be called by
504
- // UNDONE: need a way to refresh the table with more information as more data comes online for browse info like
505
- // table names and key information
506
499
#if ! NETFRAMEWORK
507
500
[ SuppressMessage ( "ReflectionAnalysis" , "IL2111" ,
508
501
Justification = "System.Type.TypeInitializer would not be used in dataType and providerSpecificDataType columns." ) ]
@@ -1193,7 +1186,7 @@ private TdsOperationStatus TryCloseInternal(bool closeReader)
1193
1186
CleanupAfterAsyncInvocationInternal ( stateObj ) ;
1194
1187
}
1195
1188
1196
- // SQLBUDT #284712 - Note the order here is extremely important:
1189
+ // Note the order here is extremely important:
1197
1190
//
1198
1191
// (1) First, we remove the reader from the reference collection
1199
1192
// to prevent it from being forced closed by the parser if
@@ -1271,6 +1264,7 @@ private TdsOperationStatus TryCloseInternal(bool closeReader)
1271
1264
}
1272
1265
throw ;
1273
1266
}
1267
+ // DO NOT USE stateObj after this point - it has been returned to the TdsParser's session pool and potentially handed out to another thread
1274
1268
1275
1269
// do not retry here
1276
1270
result = TrySetMetaData ( null , false ) ;
@@ -1657,7 +1651,7 @@ override public int GetOrdinal(string name)
1657
1651
CheckMetaDataIsReady ( ) ;
1658
1652
_fieldNameLookup = new FieldNameLookup ( this , _defaultLCID ) ;
1659
1653
}
1660
- return _fieldNameLookup . GetOrdinal ( name ) ; // MDAC 71470
1654
+ return _fieldNameLookup . GetOrdinal ( name ) ;
1661
1655
}
1662
1656
finally
1663
1657
{
@@ -2344,7 +2338,7 @@ override public TextReader GetTextReader(int i)
2344
2338
}
2345
2339
2346
2340
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetChar/*' />
2347
- [ EditorBrowsableAttribute ( EditorBrowsableState . Never ) ] // MDAC 69508
2341
+ [ EditorBrowsableAttribute ( EditorBrowsableState . Never ) ]
2348
2342
override public char GetChar ( int i )
2349
2343
{
2350
2344
throw ADP . NotSupported ( ) ;
@@ -2423,7 +2417,6 @@ override public long GetChars(int i, long dataIndex, char[] buffer, int bufferIn
2423
2417
}
2424
2418
catch ( Exception ex )
2425
2419
{
2426
- // Dev11 Bug #315513: Exception type breaking change from 4.0 RTM when calling GetChars on null xml
2427
2420
// We need to wrap all exceptions inside a TargetInvocationException to simulate calling CreateSqlReader via MethodInfo.Invoke
2428
2421
if ( ADP . IsCatchableExceptionType ( ex ) )
2429
2422
{
@@ -2504,7 +2497,6 @@ override public long GetChars(int i, long dataIndex, char[] buffer, int bufferIn
2504
2497
}
2505
2498
catch ( Exception e )
2506
2499
{
2507
- // UNDONE - should not be catching all exceptions!!!
2508
2500
if ( ! ADP . IsCatchableExceptionType ( e ) )
2509
2501
{
2510
2502
throw ;
@@ -2895,7 +2887,6 @@ virtual public SqlSingle GetSqlSingle(int i)
2895
2887
}
2896
2888
2897
2889
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetSqlString/*' />
2898
- // UNDONE: need non-unicode SqlString support
2899
2890
virtual public SqlString GetSqlString ( int i )
2900
2891
{
2901
2892
ReadColumn ( i ) ;
@@ -2985,8 +2976,6 @@ private object GetSqlValueInternal(int i)
2985
2976
// Always make sure to take reference copies of anything set to null in TryCloseInternal()
2986
2977
private object GetSqlValueFromSqlBufferInternal ( SqlBuffer data , _SqlMetaData metaData )
2987
2978
{
2988
- // Dev11 Bug #336820, Dev10 Bug #479607 (SqlClient: IsDBNull always returns false for timestamp datatype)
2989
- // Due to a bug in TdsParser.GetNullSqlValue, Timestamps' IsNull is not correctly set - so we need to bypass the following check
2990
2979
Debug . Assert ( ! data . IsEmpty || data . IsNull || metaData . type == SqlDbType . Timestamp , "Data has been read, but the buffer is empty" ) ;
2991
2980
2992
2981
// Convert 2008 types to string
@@ -3177,8 +3166,6 @@ private object GetValueInternal(int i)
3177
3166
// Always make sure to take reference copies of anything set to null in TryCloseInternal()
3178
3167
private object GetValueFromSqlBufferInternal ( SqlBuffer data , _SqlMetaData metaData )
3179
3168
{
3180
- // Dev11 Bug #336820, Dev10 Bug #479607 (SqlClient: IsDBNull always returns false for timestamp datatype)
3181
- // Due to a bug in TdsParser.GetNullSqlValue, Timestamps' IsNull is not correctly set - so we need to bypass the following check
3182
3169
Debug . Assert ( ! data . IsEmpty || data . IsNull || metaData . type == SqlDbType . Timestamp , "Data has been read, but the buffer is empty" ) ;
3183
3170
3184
3171
if ( _typeSystem <= SqlConnectionString . TypeSystem . SQLServer2005 && metaData . Is2008DateTimeType )
@@ -3503,7 +3490,7 @@ override public int GetValues(object[] values)
3503
3490
_data [ i ] . Clear ( ) ;
3504
3491
if ( fieldIndex > i && fieldIndex > 0 )
3505
3492
{
3506
- // if we jumped an index forward because of a hidden column see if the buffer before the
3493
+ // if we jumped an index forward because of a hidden column see if the buffer before the
3507
3494
// current one was populated by the seek forward and clear it if it was
3508
3495
_data [ fieldIndex - 1 ] . Clear ( ) ;
3509
3496
}
@@ -3595,10 +3582,6 @@ private TdsOperationStatus TryHasMoreResults(out bool moreResults)
3595
3582
// always happens if there is a row following an altrow
3596
3583
moreResults = true ;
3597
3584
return TdsOperationStatus . Done ;
3598
-
3599
- // VSTFDEVDIV 926281: DONEINPROC case is missing here; we have decided to reject this bug as it would result in breaking change
3600
- // from VS2008 RTM/SP1 and Dev10 RTM. See the bug for more details.
3601
- // case TdsEnums.DONEINPROC:
3602
3585
case TdsEnums . SQLDONE :
3603
3586
Debug . Assert ( _altRowStatus == ALTROWSTATUS . Done || _altRowStatus == ALTROWSTATUS . Null , "invalid AltRowStatus" ) ;
3604
3587
_altRowStatus = ALTROWSTATUS . Null ;
@@ -3628,8 +3611,6 @@ private TdsOperationStatus TryHasMoreResults(out bool moreResults)
3628
3611
return TdsOperationStatus . Done ;
3629
3612
}
3630
3613
3631
- // Dev11 Bug 316483: Stuck at SqlDataReader::TryHasMoreResults using MARS
3632
- // http://vstfdevdiv:8080/web/wi.aspx?pcguid=22f9acc9-569a-41ff-b6ac-fac1b6370209&id=316483
3633
3614
// TryRun() will immediately return if the TdsParser is closed/broken, causing us to enter an infinite loop
3634
3615
// Instead, we will throw a closed connection exception
3635
3616
if ( _parser . State == TdsParserState . Broken || _parser . State == TdsParserState . Closed )
@@ -3674,19 +3655,6 @@ private TdsOperationStatus TryHasMoreRows(out bool moreRows)
3674
3655
if ( _stateObj . HasPendingData )
3675
3656
{
3676
3657
// Consume error's, info's, done's on HasMoreRows, so user obtains error on Read.
3677
- // Previous bug where Read() would return false with error on the wire in the case
3678
- // of metadata and error immediately following. See MDAC 78285 and 75225.
3679
-
3680
- // BUGBUG - currently in V1 the if (_parser.PendingData) does not
3681
- // exist, so under certain conditions HasMoreRows can timeout. However,
3682
- // this should only occur when executing as SqlBatch and returning a reader.
3683
- // Updated - SQL Bug: 20001249
3684
- // Modifed while loop and added parsedDoneToken, to revert a regression from everettfs.
3685
- // "Error Exceptions" are now only thown in read when a error occures in the exception, otherwise the exception will be thrown on the call to get the next result set.
3686
- // resultset.
3687
-
3688
- // process any done, doneproc and doneinproc token streams and
3689
- // any order, error or info token preceeding the first done, doneproc or doneinproc token stream
3690
3658
byte b ;
3691
3659
TdsOperationStatus result = _stateObj . TryPeekByte ( out b ) ;
3692
3660
if ( result != TdsOperationStatus . Done )
@@ -3713,8 +3681,6 @@ private TdsOperationStatus TryHasMoreRows(out bool moreRows)
3713
3681
ParsedDoneToken = true ;
3714
3682
}
3715
3683
3716
- // Dev11 Bug 316483: Stuck at SqlDataReader::TryHasMoreResults when using MARS
3717
- // http://vstfdevdiv:8080/web/wi.aspx?pcguid=22f9acc9-569a-41ff-b6ac-fac1b6370209&id=316483
3718
3684
// TryRun() will immediately return if the TdsParser is closed/broken, causing us to enter an infinite loop
3719
3685
// Instead, we will throw a closed connection exception
3720
3686
if ( _parser . State == TdsParserState . Broken || _parser . State == TdsParserState . Closed )
@@ -4895,25 +4861,19 @@ internal TdsOperationStatus TrySetMetaData(_SqlMetaDataSet metaData, bool moreIn
4895
4861
4896
4862
if ( _parser != null )
4897
4863
{ // There is a valid case where parser is null
4898
- // Peek, and if row token present, set _hasRows true since there is a
4899
- // row in the result
4864
+ // Peek, and if row token present, set _hasRows true since there is a
4865
+ // row in the result
4900
4866
byte b ;
4901
4867
TdsOperationStatus result = _stateObj . TryPeekByte ( out b ) ;
4902
4868
if ( result != TdsOperationStatus . Done )
4903
4869
{
4904
4870
return result ;
4905
4871
}
4906
4872
4907
- // UNDONE - should we be consuming tokens here??? Maybe we should be calling HasMoreRows?
4908
- // Would that have other side effects?
4909
-
4910
4873
// simply rip the order token off the wire
4911
4874
if ( b == TdsEnums . SQLORDER )
4912
- {
4875
+ {
4913
4876
// same logic as SetAltMetaDataSet
4914
- // Devnote: That's not the right place to process TDS
4915
- // Can this result in Reentrance to Run?
4916
-
4917
4877
result = _parser . TryRun ( RunBehavior . ReturnImmediately , null , null , null , _stateObj , out _ ) ;
4918
4878
if ( result != TdsOperationStatus . Done )
4919
4879
{
@@ -5151,7 +5111,7 @@ private static Task<bool> NextResultAsyncExecute(Task task, object state)
5151
5111
5152
5112
if ( context . Reader . TryNextResult ( out bool more ) == TdsOperationStatus . Done )
5153
5113
{
5154
- // completed
5114
+ // completed
5155
5115
return more ? ADP . TrueTask : ADP . FalseTask ;
5156
5116
}
5157
5117
@@ -5573,7 +5533,7 @@ private static Task<bool> ReadAsyncExecute(Task task, object state)
5573
5533
// If there are no more rows, or this is Sequential Access, then we are done
5574
5534
if ( ! hasMoreData || ( reader . _commandBehavior & CommandBehavior . SequentialAccess ) == CommandBehavior . SequentialAccess )
5575
5535
{
5576
- // completed
5536
+ // completed
5577
5537
return hasMoreData ? ADP . TrueTask : ADP . FalseTask ;
5578
5538
}
5579
5539
else
@@ -5590,7 +5550,7 @@ private static Task<bool> ReadAsyncExecute(Task task, object state)
5590
5550
TdsOperationStatus result = reader . TryReadColumn ( reader . _metaData . Length - 1 , true ) ;
5591
5551
if ( result == TdsOperationStatus . Done )
5592
5552
{
5593
- // completed
5553
+ // completed
5594
5554
return ADP . TrueTask ;
5595
5555
}
5596
5556
}
0 commit comments