File tree Expand file tree Collapse file tree 3 files changed +8
-20
lines changed
src/Microsoft.Data.SqlClient
netcore/src/Microsoft/Data/SqlClient
netfx/src/Microsoft/Data/SqlClient
tests/ManualTests/SQL/DataReaderTest Expand file tree Collapse file tree 3 files changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -1479,7 +1479,7 @@ public override DataTable GetSchemaTable()
14791479 Debug . Assert ( null != _metaData . schemaTable , "No schema information yet!" ) ;
14801480 }
14811481 }
1482- return _metaData ? . schemaTable ?? new DataTable ( ) ;
1482+ return _metaData ? . schemaTable ;
14831483 }
14841484 finally
14851485 {
Original file line number Diff line number Diff line change @@ -1679,12 +1679,17 @@ override public DataTable GetSchemaTable()
16791679 {
16801680 if ( null != this . MetaData )
16811681 {
1682+
16821683 _metaData . schemaTable = BuildSchemaTable ( ) ;
16831684 Debug . Assert ( null != _metaData . schemaTable , "No schema information yet!" ) ;
16841685 // filter table?
16851686 }
16861687 }
1687- return _metaData ? . schemaTable ?? new DataTable ( ) ;
1688+ if ( null != _metaData )
1689+ {
1690+ return _metaData . schemaTable ;
1691+ }
1692+ return null ;
16881693 }
16891694 finally
16901695 {
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public static void LoadReaderIntoDataTableToTestGetSchemaTable()
3737 [ ConditionalFact ( typeof ( DataTestUtility ) , nameof ( DataTestUtility . AreConnStringsSetup ) ) ]
3838 public static void MultiQuerySchema ( )
3939 {
40+ SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder ( DataTestUtility . TCPConnectionString ) ;
4041 using ( SqlConnection connection = new SqlConnection ( DataTestUtility . TCPConnectionString ) )
4142 {
4243 connection . Open ( ) ;
@@ -65,25 +66,7 @@ public static void MultiQuerySchema()
6566 }
6667 }
6768
68- [ ConditionalFact ( typeof ( DataTestUtility ) , nameof ( DataTestUtility . AreConnStringsSetup ) ) ]
69- public static void GetSchemaTable_returns_null_when_no_resultset ( )
70- {
71- using ( SqlConnection connection = new SqlConnection ( DataTestUtility . TCPConnectionString ) )
72- {
73- connection . Open ( ) ;
7469
75- using ( SqlCommand command = connection . CreateCommand ( ) )
76- {
77- command . CommandText = "SELECT 1" ;
78- using ( SqlDataReader reader = command . ExecuteReader ( ) )
79- {
80- reader . NextResult ( ) ;
81- Assert . NotNull ( reader . GetSchemaTable ( ) ) ;
82- }
83- }
84- }
85- }
86-
8770 // Checks for the IsColumnSet bit in the GetSchemaTable for Sparse columns
8871 [ ConditionalFact ( typeof ( DataTestUtility ) , nameof ( DataTestUtility . AreConnStringsSetup ) ) ]
8972 public static void CheckSparseColumnBit ( )
You can’t perform that action at this time.
0 commit comments