Files
sqltoolsservice/test/Microsoft.SqlTools.ServiceLayer.Test/Utility/TestDbColumn.cs
Benjamin Russell 0f19de38fb Date & Time Type Fixes (#196)
This basically is a replacement to the fix for Adding Milliseconds to DateTime fields. I didn't take into consideration that `DATE` columns would report as DateTime type. Date columns have a numeric scale set to 255, leading to the formatting string for the date time to include 255 millisecond places, which is invalid.

This change also reverses the change to store DateTime precision in the buffer file. Instead, the column metadata is now used when deserializing the rows from the db. `DATETIME` and `DATETIME2` columns are differentiated by their numeric scale while `DATE` columns are differentiated by their datatype name field.

More unit tests were added. Additionally, this fixes an unreported bug that `DATE` columns were being displayed with times, which is incorrect.

* Revert "Adding Milliseconds to DateTime fields (#173)"

This reverts commit 431dfa4156.

* Reworking the reader to use the column metadata for date types

* DbColumn -> DbColumnWrapper

* Fina tweaks to support DATETIME2(0)

* Removing the unused arguments
2016-12-20 11:22:00 -08:00

34 lines
942 B
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Data.Common;
namespace Microsoft.SqlTools.ServiceLayer.Test.Utility
{
public class TestDbColumn : DbColumn
{
public TestDbColumn(string columnName)
{
base.IsLong = false;
base.ColumnName = columnName;
base.ColumnSize = 128;
base.AllowDBNull = true;
base.DataType = typeof(string);
base.DataTypeName = "nvarchar";
}
public TestDbColumn(string columnName, string columnType)
: this(columnName)
{
base.DataTypeName = columnType;
}
public TestDbColumn(string columnName, string columnType, int scale)
: this(columnName, columnType)
{
base.NumericScale = scale;
}
}
}