Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -226,6 +226,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlMetaDataFactory.cs">
<Link>Microsoft\Data\SqlClient\SqlMetaDataFactory.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlNotificationInfo.cs">
<Link>Microsoft\Data\SqlClient\SqlNotificationInfo.cs</Link>
</Compile>
Expand Down Expand Up @@ -518,7 +521,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalTransaction.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlMetadataFactory.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlNotificationEventArgs.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlParameter.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlReferenceCollection.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlMetaDataFactory.cs">
<Link>Microsoft\Data\SqlClient\SqlMetaDataFactory.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlNotificationInfo.cs">
<Link>Microsoft\Data\SqlClient\SqlNotificationInfo.cs</Link>
</Compile>
Expand Down Expand Up @@ -480,7 +483,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnectionSmi.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs" />
<Compile Include="Microsoft\Data\SqlClient\sqlinternaltransaction.cs" />
<Compile Include="Microsoft\Data\SqlClient\sqlmetadatafactory.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlNotificationEventArgs.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlParameter.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlQueryMetadataCache.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ namespace Microsoft.Data.SqlClient
internal sealed class SqlMetaDataFactory : DbMetaDataFactory
{

private const string _serverVersionNormalized90 = "09.00.0000";
private const string _serverVersionNormalized90782 = "09.00.0782";
private const string _serverVersionNormalized10 = "10.00.0000";
private const string ServerVersionNormalized90 = "09.00.0000";
private const string ServerVersionNormalized10 = "10.00.0000";


public SqlMetaDataFactory(Stream XMLStream,
Expand Down Expand Up @@ -45,15 +44,14 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con
"on assemblies.assembly_id = types.assembly_id ";

// pre 9.0/Yukon servers do not have UDTs
if (0 > string.Compare(ServerVersion, _serverVersionNormalized90, StringComparison.OrdinalIgnoreCase))
if (0 > string.Compare(ServerVersion, ServerVersionNormalized90, StringComparison.OrdinalIgnoreCase))
{
return;
}

// Execute the SELECT statement
SqlCommand command = connection.CreateCommand();
command.CommandText = sqlCommand;
DataRow newRow = null;
DataColumn providerDbtype = dataTypesTable.Columns[DbMetaDataColumnNames.ProviderDbType];
DataColumn columnSize = dataTypesTable.Columns[DbMetaDataColumnNames.ColumnSize];
DataColumn isFixedLength = dataTypesTable.Columns[DbMetaDataColumnNames.IsFixedLength];
Expand Down Expand Up @@ -94,7 +92,7 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con
{

reader.GetValues(values);
newRow = dataTypesTable.NewRow();
DataRow newRow = dataTypesTable.NewRow();

newRow[providerDbtype] = SqlDbType.Udt;

Expand Down Expand Up @@ -123,7 +121,7 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con
(values[versionRevisionIndex] != DBNull.Value))
{

StringBuilder nameString = new StringBuilder();
StringBuilder nameString = new();
nameString.Append(values[assemblyClassIndex].ToString());
nameString.Append(", ");
nameString.Append(values[assemblyNameIndex].ToString());
Expand All @@ -148,7 +146,7 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con

nameString.Append(", PublicKeyToken=");

StringBuilder resultString = new StringBuilder();
StringBuilder resultString = new();
byte[] byteArrayValue = (byte[])values[publicKeyIndex];
foreach (byte b in byteArrayValue)
{
Expand Down Expand Up @@ -179,15 +177,14 @@ private void AddTVPsToDataTypesTable(DataTable dataTypesTable, SqlConnection con

// TODO: update this check once the server upgrades major version number!!!
// pre 9.0/Yukon servers do not have Table types
if (0 > string.Compare(ServerVersion, _serverVersionNormalized10, StringComparison.OrdinalIgnoreCase))
if (0 > string.Compare(ServerVersion, ServerVersionNormalized10, StringComparison.OrdinalIgnoreCase))
{
return;
}

// Execute the SELECT statement
SqlCommand command = connection.CreateCommand();
command.CommandText = sqlCommand;
DataRow newRow = null;
DataColumn providerDbtype = dataTypesTable.Columns[DbMetaDataColumnNames.ProviderDbType];
DataColumn columnSize = dataTypesTable.Columns[DbMetaDataColumnNames.ColumnSize];
DataColumn isSearchable = dataTypesTable.Columns[DbMetaDataColumnNames.IsSearchable];
Expand Down Expand Up @@ -217,7 +214,7 @@ private void AddTVPsToDataTypesTable(DataTable dataTypesTable, SqlConnection con
{

reader.GetValues(values);
newRow = dataTypesTable.NewRow();
DataRow newRow = dataTypesTable.NewRow();

newRow[providerDbtype] = SqlDbType.Structured;

Expand Down