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

Fix | Fix SqlClientMetaDataCollectionNames.Parameters mismatching issue #580

Merged
merged 2 commits into from
Jun 10, 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 @@ -24,14 +24,10 @@
<summary>A constant for use with the **GetSchema** method that represents the **Indexes** collection.</summary>
<remarks>To be added.</remarks>
</Indexes>
<Parameters>
<summary>A constant for use with the **GetSchema** method that represents the **Parameters** collection.</summary>
<ProcedureParameters>
<summary>A constant for use with the **GetSchema** method that represents the **ProcedureParameters** collection.</summary>
<remarks>To be added.</remarks>
</Parameters>
<ProcedureColumns>
<summary>A constant for use with the **GetSchema** method that represents the **ProcedureColumns** collection.</summary>
<remarks>To be added.</remarks>
</ProcedureColumns>
</ProcedureParameters>
<Procedures>
<summary>A constant for use with the **GetSchema** method that represents the **Procedures** collection.</summary>
<remarks>To be added.</remarks>
Expand All @@ -56,5 +52,13 @@
<summary>A constant for use with the **GetSchema** method that represents the **Views** collection.</summary>
<remarks>To be added.</remarks>
</Views>
<AllColumns>
<summary>A constant for use with the **GetSchema** method that represents the **AllColumns** collection.</summary>
<remarks>To be added.</remarks>
</AllColumns>
<ColumnSetColumns>
<summary>A constant for use with the **GetSchema** method that represents the **ColumnSetColumns** collection.</summary>
<remarks>To be added.</remarks>
</ColumnSetColumns>
</members>
</docs>
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,8 @@ public static partial class SqlClientMetaDataCollectionNames
public static readonly string IndexColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Indexes/*'/>
public static readonly string Indexes;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Parameters/*'/>
public static readonly string Parameters;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureColumns/*'/>
public static readonly string ProcedureColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureParameters/*'/>
public static readonly string ProcedureParameters;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Procedures/*'/>
public static readonly string Procedures;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Tables/*'/>
Expand All @@ -306,6 +304,10 @@ public static partial class SqlClientMetaDataCollectionNames
public static readonly string ViewColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Views/*'/>
public static readonly string Views;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/AllColumns/*'/>
public static readonly string AllColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ColumnSetColumns/*'/>
public static readonly string ColumnSetColumns;
}
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/SqlCommand/*'/>
[System.ComponentModel.DefaultEventAttribute("RecordsAffected")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ public static class SqlClientMetaDataCollectionNames
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Indexes/*' />
public static readonly string Indexes = "Indexes";

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Parameters/*' />
public static readonly string Parameters = "Parameters";

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureColumns/*' />
public static readonly string ProcedureColumns = "ProcedureColumns";
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureParameters/*' />
public static readonly string ProcedureParameters = "ProcedureParameters";

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Procedures/*' />
public static readonly string Procedures = "Procedures";
Expand All @@ -46,5 +43,11 @@ public static class SqlClientMetaDataCollectionNames

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Views/*' />
public static readonly string Views = "Views";

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/AllColumns/*' />
public static readonly string AllColumns = "AllColumns"; // supported starting from SQL Server 2008

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ColumnSetColumns/*' />
public static readonly string ColumnSetColumns = "ColumnSetColumns"; // supported starting from SQL Server 2008
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,8 @@ public static partial class SqlClientMetaDataCollectionNames
public static readonly string IndexColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Indexes/*'/>
public static readonly string Indexes;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Parameters/*'/>
public static readonly string Parameters;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureColumns/*'/>
public static readonly string ProcedureColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureParameters/*'/>
public static readonly string ProcedureParameters;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Procedures/*'/>
public static readonly string Procedures;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Tables/*'/>
Expand All @@ -343,6 +341,10 @@ public static partial class SqlClientMetaDataCollectionNames
public static readonly string ViewColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Views/*'/>
public static readonly string Views;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/AllColumns/*'/>
public static readonly string AllColumns;
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ColumnSetColumns/*'/>
public static readonly string ColumnSetColumns;
}
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientPermission.xml' path='docs/members[@name="SqlClientPermission"]/SqlClientPermission/*'/>
public sealed partial class SqlClientPermission : System.Data.Common.DBDataPermission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ public static class SqlClientMetaDataCollectionNames
/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Indexes/*' />
public static readonly string Indexes = "Indexes";

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Parameters/*' />
public static readonly string Parameters = "Parameters";

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureColumns/*' />
public static readonly string ProcedureColumns = "ProcedureColumns";
/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ProcedureParameters/*' />
public static readonly string ProcedureParameters = "ProcedureParameters";

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Procedures/*' />
public static readonly string Procedures = "Procedures";
Expand All @@ -46,5 +43,11 @@ public static class SqlClientMetaDataCollectionNames
/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/Views/*' />
public static readonly string Views = "Views";

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/AllColumns/*' />
public static readonly string AllColumns = "AllColumns"; // supported starting from SQL Server 2008

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/ColumnSetColumns/*' />
public static readonly string ColumnSetColumns = "ColumnSetColumns"; // supported starting from SQL Server 2008

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ public void ValuesTest()
Assert.Equal("ForeignKeys", SqlClientMetaDataCollectionNames.ForeignKeys);
Assert.Equal("IndexColumns", SqlClientMetaDataCollectionNames.IndexColumns);
Assert.Equal("Indexes", SqlClientMetaDataCollectionNames.Indexes);
Assert.Equal("Parameters", SqlClientMetaDataCollectionNames.Parameters);
Assert.Equal("ProcedureColumns", SqlClientMetaDataCollectionNames.ProcedureColumns);
Assert.Equal("ProcedureParameters", SqlClientMetaDataCollectionNames.ProcedureParameters);
Assert.Equal("Procedures", SqlClientMetaDataCollectionNames.Procedures);
Assert.Equal("Tables", SqlClientMetaDataCollectionNames.Tables);
Assert.Equal("UserDefinedTypes", SqlClientMetaDataCollectionNames.UserDefinedTypes);
Assert.Equal("Users", SqlClientMetaDataCollectionNames.Users);
Assert.Equal("ViewColumns", SqlClientMetaDataCollectionNames.ViewColumns);
Assert.Equal("Views", SqlClientMetaDataCollectionNames.Views);
Assert.Equal("AllColumns", SqlClientMetaDataCollectionNames.AllColumns);
Assert.Equal("ColumnSetColumns", SqlClientMetaDataCollectionNames.ColumnSetColumns);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,89 @@ public static class ConnectionSchemaTest
{

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetAllTablesFromSchema()
public static void GetTablesFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Tables, new string[] { "TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME", "TABLE_TYPE" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetAllProceduresFromSchema()
public static void GetProceduresFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Procedures, new string[] { "ROUTINE_SCHEMA", "ROUTINE_NAME", "ROUTINE_TYPE" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetProcedureParametersFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.ProcedureParameters, new string[] { "PARAMETER_MODE", "PARAMETER_NAME" });
karinazhou marked this conversation as resolved.
Show resolved Hide resolved
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetDatabasesFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Databases, new string[] { "database_name", "dbid", "create_date" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetForeignKeysFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.ForeignKeys, new string[] { "CONSTRAINT_TYPE", "IS_DEFERRABLE", "INITIALLY_DEFERRED" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetIndexesFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Indexes, new string[] { "index_name", "constraint_name" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetIndexColumnsFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.IndexColumns, new string[] { "index_name", "KeyType", "column_name" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetColumnsFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Columns, new string[] { "IS_NULLABLE", "COLUMN_DEFAULT" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetAllColumnsFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.AllColumns, new string[] { "IS_NULLABLE", "COLUMN_DEFAULT", "IS_FILESTREAM", "IS_SPARSE", "IS_COLUMN_SET" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetColumnSetColumnsFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.ColumnSetColumns, new string[] { "IS_NULLABLE", "COLUMN_DEFAULT", "IS_FILESTREAM", "IS_SPARSE", "IS_COLUMN_SET" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetUsersFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Users, new string[] { "uid", "user_name" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetViewsFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.Views, new string[] { "TABLE_NAME", "CHECK_OPTION", "IS_UPDATABLE" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetViewColumnsFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.ViewColumns, new string[] { "VIEW_CATALOG", "VIEW_SCHEMA", "VIEW_NAME" });
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void GetUserDefinedTypesFromSchema()
{
VerifySchemaTable(SqlClientMetaDataCollectionNames.UserDefinedTypes, new string[] { "assembly_name", "version_revision", "culture_info" });
}

private static void VerifySchemaTable(string schemaItemName, string[] testColumnNames)
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TCPConnectionString)
Expand All @@ -36,9 +108,6 @@ private static void VerifySchemaTable(string schemaItemName, string[] testColumn
connection.Open();
DataTable table = connection.GetSchema(schemaItemName);

// Display the contents of the table.
Assert.InRange<int>(table.Rows.Count, 1, int.MaxValue);

// Get all table columns
HashSet<string> columnNames = new HashSet<string>();

Expand Down