handle sql variable type (#1333)

* handle sql variable type

* comments
This commit is contained in:
Alan Ren
2021-12-07 19:23:15 -08:00
committed by GitHub
parent 822a6459ce
commit 51c801eb33
5 changed files with 29 additions and 7 deletions

View File

@@ -134,14 +134,15 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
continue;
}
// The typename is stored in the string
colType = Type.GetType(sqlVariantType);
// Workaround .NET bug, see sqlbu# 440643 and vswhidbey# 599834
// TODO: Is this workaround necessary for .NET Core?
if (colType == null && sqlVariantType == "System.Data.SqlTypes.SqlSingle")
// We need to specify the assembly name for SQL types in order to resolve the type correctly.
if (sqlVariantType.StartsWith("System.Data.SqlTypes."))
{
colType = typeof(SqlSingle);
sqlVariantType = sqlVariantType + ", System.Data.Common";
}
colType = Type.GetType(sqlVariantType);
if (colType == null)
{
throw new ArgumentException(SR.QueryServiceUnsupportedSqlVariantType(sqlVariantType, column.ColumnName));
}
}
else