Getting rid of new methods in favor of just assigning the base (#198)

This change is a refactor of the DbColumnWrapper class. This fixes a huge oversight/gotcha in the DbColumnWrapper where treating the DbColumnWrapper as a DbColumn (ie, polymorphism) would result in almost all the fields of the column being null. This is a highly unexpected behavior. This change fixes that.
This commit is contained in:
Benjamin Russell
2016-12-19 15:27:13 -08:00
committed by GitHub
parent ba12a80fbf
commit 1ada659a8a
3 changed files with 38 additions and 55 deletions

View File

@@ -140,12 +140,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
}
else
{
if (!ci.IsLong)
{
// not a long field
values[i] = reader.GetValue(i);
}
else
if (ci.IsLong.HasValue && ci.IsLong.Value)
{
// this is a long field
if (ci.IsBytes)
@@ -169,6 +164,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
Debug.Assert(false);
}
}
else
{
// not a long field
values[i] = reader.GetValue(i);
}
}
}

View File

@@ -57,7 +57,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
// Read the columns into a set of wrappers
Columns = DbDataReader.GetColumnSchema().Select(column => new DbColumnWrapper(column)).ToArray();
HasLongColumns = Columns.Any(column => column.IsLong);
HasLongColumns = Columns.Any(column => column.IsLong.HasValue && column.IsLong.Value);
}
#region Properties