Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Return empty DataTable from GetSchemaTable. (#419)" #696

Merged
merged 2 commits into from
Aug 20, 2020
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 @@ -1454,7 +1454,7 @@ public override DataTable GetSchemaTable()
Debug.Assert(null != _metaData.schemaTable, "No schema information yet!");
}
}
return _metaData?.schemaTable ?? new DataTable();
return _metaData?.schemaTable;
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1681,10 +1681,9 @@ override public DataTable GetSchemaTable()
{
_metaData.schemaTable = BuildSchemaTable();
Debug.Assert(null != _metaData.schemaTable, "No schema information yet!");
// filter table?
}
}
return _metaData?.schemaTable ?? new DataTable();
return _metaData?.schemaTable;
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static void LoadReaderIntoDataTableToTestGetSchemaTable()
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void MultiQuerySchema()
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TCPConnectionString);
cheenamalhotra marked this conversation as resolved.
Show resolved Hide resolved
using (SqlConnection connection = new SqlConnection(DataTestUtility.TCPConnectionString))
{
connection.Open();
Expand Down Expand Up @@ -66,25 +67,7 @@ public static void MultiQuerySchema()
}
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetSchemaTable_returns_null_when_no_resultset()
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TCPConnectionString))
{
connection.Open();

using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "SELECT 1";
using (SqlDataReader reader = command.ExecuteReader())
{
reader.NextResult();
Assert.NotNull(reader.GetSchemaTable());
}
}
}
}

// Checks for the IsColumnSet bit in the GetSchemaTable for Sparse columns
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void CheckSparseColumnBit()
Expand Down